Here is an old result of Siegel that is related to your question.

Set

$$ s=s(a_1,\dotsc, a_n)=\frac{1}{n} (a_1+\cdots +a_n), $$

$$ p= p(a_1,\dotsc, a_n)=a_1\cdots a_n, $$

$$ \Delta= \Delta(a_1,\dotsc, a_n)=\prod_{i,j}(a_i-a_j)^2. $$

The AM-GM inequality reads

$$\frac{s^n}{p}\geq 1. $$

Observe that $s$ is homogeneous of degree $1$, $p$ is homogeneous of degree $n$ and $\Delta$ is homogeneous of degree $n(n-1)$ in the variables $a_j$. In particular, the ratio

$$ R= \frac{p^{n-1}}{\Delta} $$

is homogeneous of degree $0$.
Note that $\Delta=0$ when two of the numbers $a_j$ are equal. In particular, large $\Delta $ would mean that the numbers are "far from being equal". Equivalently, the larger $\Delta$ is, the more "dispersed" are the numbers $a_j$.

One can ask how dispersed can the numbers $a_j$ be given that $s$ and $p$ are fixed. In other words we ask to find

$$\max \Delta(a_1,\dotsc, a_n)$$

given that

$$s(a_1,\dotsc, a_n)=s_0,\;\;p(a_1,\dotsc, a_n)=p_0. $$

This constrained maximum exists and can be described *explicitly* as the discriminant of a certain Laguerre polynomial. I will denote it by $\Delta_\max(s_0,p_0)$.

I will set

$$ \rho=\rho(s_0,p_0)= \frac{p_0^{n-1}}{\Delta_\max(s_0,p_0)}. $$

Then there exists an *explicit* but *very complicated* *strictly decreasing continuous function*

$$ F_n: (0,\infty)\to (1,\infty) $$

such that

$$\lim_{t\to\infty} F_n(t)=1, $$

$$\frac{s(a_1,\dotsc,a_n)^n}{p(a_1,\dotsc,a_n)}= \frac{s_0^n}{p_0}= F_n(\rho)= F_n\left( \frac{p_0^{n-1}}{\Delta_\max(s_0,p_0)}\right) \geq F_n\left(\frac{p(a_1,\dotsc, a_n)^{n-1}}{\Delta(a_1,\dotsc, a_n)}\right). $$

Here are a few more things things about the function $F_n$. It is described as a composition $Q_n\circ P_n^{-1}$, were

$$ Q_n: (0,\infty)\to (1,\infty) $$

is a *strictly decreasing, very explicit* rational function and

$$P_n:(0,\infty)\to (0,\infty) $$

is a *very explicit* and *strictly increasing* polynomial such that $P_n(0)=0$. This implies the sharper inequality

$$ s(a_1, \dotsc, a_n)^n \geq F_n\left(\frac{p(a_1,\dotsc, a_n)^{n-1}}{\Delta(a_1,\dotsc, a_n)}\right)p(a_1,\dotsc, a_n), $$

with equality iff

$$ \Delta(a_1,\dotsc,a_n)=\Delta_\max(s,p). $$

For more details see Sec. 8.6 of the beautiful book **Special Functions** by G.E. Andrews, R. Askey, R. Roy.