The binomial expansion of \( \left( \frac{1}{2} + \frac{1}{8} \right)^{1016} \) contains terms of the form:
\[
T_r = \binom{1016}{r} \left( \frac{1}{2} \right)^{1016-r} \left( \frac{1}{8} \right)^r
\]
Simplifying the general term:
\[
T_r = \binom{1016}{r} \cdot \frac{1}{2^{1016-r}} \cdot \frac{1}{8^r} = \binom{1016}{r} \cdot \frac{1}{2^{1016 - r + 3r}} = \binom{1016}{r} \cdot \frac{1}{2^{1016 + 2r}}
\]
For \( T_r \) to be a rational number, the denominator of the term must be a power of 2. We observe that for the denominator to be a power of 2, \( 1016 + 2r \) must be an integer.
Thus, \( 1016 + 2r \) must be an even number. The total number of rational terms is the number of \( r \) for which \( 1016 + 2r \) is an even integer.
From this, we conclude that the number of rational terms is 128.
Thus, the correct answer is (2) 128.