By merging together the contributions from: a) this answer, b) the comments under this answer, we come up to the following:
Claim. For $n\in\mathbb N$, let $Q=(\{1,\dots,n\},*)$ be a quasigroup. Then, there is a deterministic $O(n^2\log n)$ runtime algorithm, which tests if $Q$ is associative (hence a group).
The proof uses the following characterization of associative quasigroups:
Lemma. $Q$ is associative if and only if the following conditions are fulfilled:
A) the induced transitive subset $\Sigma=\{\sigma_1,\dots,\sigma_n\}\subseteq S_n$, defined by: $$\sigma_i(j):=i*j \tag1$$ is a (transitive) subgroup;
B) $(i*j)*1 = i * (j * 1)$.
Proof. The forward direction is immediate, considered that the associativity is equivalent to $\sigma_i\sigma_j=\sigma_{i*j}$. For the other direction, the key point is in this comment (possibly contextualized by this thread). $\space\Box$
Proof (claim). The point A) in the Lemma takes $O(n^2\log n)$ time, whereas B) just $O(n^2)$. $\space\Box$
Now to the question:
Q. How does this deterministic algorithm compare to other ones in the literature, for testing the associativity of a Latin square? What is the optimal such one known?
Edit. I've found this one, also with $O(n^2\log n)$ time complexity, but I can't say whether it is the same as here, as I haven't got any institution affiliation to log in with.
Edit#2. Here they state:
"Theorem 1.2. There is a deterministic Turing machine that decides in time $O(n^2(\log n)^d)$ for some constant $d$ whether an $n×n$ table with entries in $[n]$ describes a group [...]", but it's not clear to me whether assuming the table to be a Latin square implies in that framework that $d=1$ (as here), or even lower (i.e. better).