Here is a slight modification of YCor's solution, which is too long to describe in a comment. It is proved in the same way.
Claim. Any identity $w(x_1,\ldots,x_n)\approx 1$ which hold almost everywhere in an infinite group must hold everywhere.
Here, an $n$-ary identity $w\approx 1$ holds almost everywhere in infinite $G$ means the solution set $S\subseteq G^n$ of $w(x_1,\ldots,x_n) = 1$ satisfies $|G^n-S|<|G^n|=|G|$.
Step 1. If $w\approx 1$ holds almost everywhere, then so does $w(x,x,x,x,\ldots,x) \approx 1$, and this has the form $x^k=1$ for some $k$ (possibly $k=0$). As noted YCor's comment to his solution, this implies $x^k=1$ holds everywhere. Thus we may assume that $w(x,x,\ldots,x)\approx 1$ holds everywhere.
Step 2. If $w\approx 1$ did not hold everywhere, then there would exist a tuple $t=(g_1,\ldots,g_n)\in G^n$ that does not satisfy it. Each conjugate of $t$ fails $w\approx 1$, so the index of the centralizer of $t$ is small, forcing $|C_G(t)|=|G|$.
Step 3. For each $h\in C_G(t)$ we have $$ w(hg_1,hg_2,\ldots,hg_n) = w(h,h,\ldots,h) w(g_1,g_2,\ldots,g_n) = 1\cdot w(g_1,g_2,\ldots,g_n) \neq 1, $$ yielding $|G|$-many failures of $w\approx 1$, namely all tuples in $C_G(t)\cdot t$. This is too many failures of $w\approx 1$, thereby contradicting the existence of even one failure $t$ of $w\approx 1$.