According to my book, the former has a higher EA than the latter group of elements because alkali metals will attain $ns^2$ configuration whereas an alkaline earth metal in the same period will attain $ns^2np^1$. Fully and half filled configurations are more stable but according to this article, there should be unfavorable interactions due to pairing of electrons in same orbital in alkali metals. Please explain what should be correct order and why?
A look at any electron affinity table reveals that in factvalkali metals have higher electron affinities than the alkaline earth metals that respectively follow them. We can say the same for nonmetallic hydrogen versus helium, these also being $s$-block elements. In fact helium, beryllium and magnesium seem to have no electron affinity at all! While the effect of pairing the valence electrons in a Group 1 element is unfavorable, having to add an electron to a higher subshell as the Group 2 elements have to do is worse.
This effect of subshell occupation shows up not only with electron affinities but also with actual compounds of the metals. Most alkali metals can form compounds as anions, while alkaline earth metals are not known to have this possibility.