Note that for all $i=1,\dots,n$:
\begin{align}\tag 1\label 1
n x_i (x_i - \bar x) &= nx_i^2 - \sum_{j=1}^n x_i x_j.\\
\overline{x}(x_i-\bar{x})&=x_i(x_i-\bar{x})-(x_i-\bar{x})^2 \\
\sum_{j=1}^nx_j-\bar x &= -n\bar x + \sum_{j=1}^n x_j = 0 \text{, and thus} \\
\tag 2 \label 2
\sum_{j=1}^n x_j(x_j-\bar{x}) &= \sum_{j=1}^n \color{blue}{\bar{x}(x_j-\bar{x})} + (x_j-\bar{x})^2 = \color{blue}0+\sum_{j=1}^n (x_j-\bar{x})^2.
\end{align}
We have
\begin{split}
\sum_{1\le i < j\le n} (x_i - x_j)^2 &= \frac12\sum_{i,j=1}^n (x_i - x_j)^2 \qquad \text{(by symmetry of the summand})\\
&= \frac12 \sum_{i,j=1}^n \color{blue}{x_i^2} -2x_ix_j+\color{blue}{x_j^2} \\
&= \frac12 \sum_{i,j=1}^n \color{blue}{2x_i^2} -2x_ix_j \\
&= \sum_{i=1}^n nx_i^2 - \sum_{i,j=1}^nx_ix_j \\
&= n\sum_{i=1}^n x_i(x_i-\bar x) \qquad \text{(by \eqref{1})} \\
&= n\sum_{i=1}^n (x_i-\bar x)^2 \qquad \text{(by \eqref{2})}.
\end{split}