One cannot tell by the light spectra. Hydrogen and antihydrogen would give the same lines in the spectrum.
The prevalence of matter over antimatter from other evidence indicates matter is predominant in the observable universe, and here is a nice review.
How do we really know that the universe is not matter-antimatter symmetric?
The Moon: Neil Armstrong did not annihilate, therefore the moon is made of matter.
The Sun: Solar cosmic rays are matter, not antimatter.
The other Planets: We have sent probes to almost all. Their survival demonstrates that the solar system is made of matter.
The Milky Way: Cosmic rays sample material from the entire galaxy. In cosmic rays, protons outnumber antiprotons $10^4$ to $1$.
The Universe at large: This is tougher. If there were antimatter galaxies then we should see gamma emissions from annihilation. Its absence is strong evidence that at least the nearby clusters of galaxies (e.g., Virgo) are matter-dominated. At larger scales there is little proof.
However, there is a problem, called the "annihilation catastrophe" which probably eliminates the possibility of a matter-antimatter symmetric universe. Essentially, causality prevents the separation of large chucks of antimatter from matter fast enough to prevent their mutual annihilation in the early universe. So the Universe is most likely matter dominated.
So the astronomers presume they are detecting hydrogen, based on the analysis above.