8. Let $a_{1}, a_{2}, a_{3}, a_{4}$ be four distinct numbers from $1, 2, \cdots, 100$, satisfying
$$
\begin{array}{l}
\left(a_{1}^{2}+a_{2}^{2}+a_{3}^{2}\right)\left(a_{2}^{2}+a_{3}^{2}+a_{4}^{2}\right) \\
=\left(a_{1} a_{2}+a_{2} a_{3}+a_{3} a_{4}\right)^{2} .
\end{array}
$$

Then the number of such ordered quadruples $\left(a_{1}, a_{2}, a_{3}, a_{4}\right)$ is $\qquad$.
8. 40 .

By the Cauchy-Schwarz inequality, we have
$$
\begin{array}{l}
\left(a_{1}^{2}+a_{2}^{2}+a_{3}^{2}\right)\left(a_{2}^{2}+a_{3}^{2}+a_{4}^{2}\right) \\
\geqslant\left(a_{1} a_{2}+a_{2} a_{3}+a_{3} a_{4}\right)^{2},
\end{array}
$$

Equality holds if and only if
$$
\frac{a_{1}}{a_{2}}=\frac{a_{2}}{a_{3}}=\frac{a_{3}}{a_{4}},
$$

which means \(a_{1}, a_{2}, a_{3}, a_{4}\) form a geometric sequence.
Thus, the problem is equivalent to counting the number of geometric sequences \(\{a_{1}, a_{2}, a_{3}, a_{4}\}\) such that
$$
\left\{a_{1}, a_{2}, a_{3}, a_{4}\right\} \subseteq\{1,2, \cdots, 100\}.
$$

Let the common ratio \(q \neq 1\) and \(q \in \mathbf{Q}\). Denote \(q=\frac{n}{m}\), where \(m\) and \(n\) are coprime positive integers, and \(m \neq n\).
First, consider the case \(n > m\).
In this case, \(a_{4}=a_{1}\left(\frac{n}{m}\right)^{3}=\frac{a_{1} n^{3}}{m^{3}}\).
Note that \(m^{3}\) and \(n^{3}\) are coprime, so \(l=\frac{a_{1}}{m^{3}} \in \mathbf{Z}_{+}\). Accordingly, \(a_{1}, a_{2}, a_{3}, a_{4}\) are \(m^{3} l, m^{2} n l, m n^{2} l, n^{3} l\), all of which are positive integers. This indicates that for any given \(q=\frac{n}{m}>1\), the number of sequences \(\{a_{1}, a_{2}, a_{3}, a_{4}\}\) that satisfy the conditions and have \(q\) as the common ratio is the number of positive integers \(l\) that satisfy the inequality \(n^{3} l \leqslant 100\), which is \(\left[\frac{100}{n^{3}}\right]\).
Since \(5^{3} > 100\), we only need to consider
$$
q=2,3, \frac{3}{2}, 4, \frac{4}{3}
$$

The total number of such geometric sequences is
$$
\begin{array}{l}
{\left[\frac{100}{8}\right]+\left[\frac{100}{27}\right]+\left[\frac{100}{27}\right]+\left[\frac{100}{64}\right]+\left[\frac{100}{64}\right]} \\
=12+3+3+1+1=20 .
\end{array}
$$

When \(n < m\), by symmetry, there are also 20 sequences \(\{a_{1}, a_{2}, a_{3}, a_{4}\}\) that satisfy the conditions.

In summary, there are 40 ordered tuples \(\left(a_{1}, a_{2}, a_{3}, a_{4}\right)\) that satisfy the conditions.