Let $A$ be a finite set with $|A|\geqslant 2$, let $n$ be a positive integer, and let $A^n$ denote the discrete $n$-dimensional hypercube (that is, $A^n$ is the Cartesian product of $n$ many copies of $A$). Given a family $\langle D_t:t\in A^n\rangle$ of measurable events in a probability space (a stochastic process), what structural information can be obtained assuming that the events $\langle D_t:t\in A^n\rangle$ are not behaving as if they were independent? We obtain an answer to this problem (in a strong quantitative sense) subject to a mild "stationarity" condition. Our result has a number of combinatorial consequences, including a new (and the most informative so far) proof of the density Hales--Jewett theorem.