Due to completely filled s-subshell in alkaline earth metals

Due to completely filled s-subshell in alkaline earth metals and completely filled valence shell(i.e., octet) in noble gases, they are highly stable. Hence energy is required to add an electron i.e., their electron gain enthalpy values are positive.

The atomic size of second period elements decreases and electron number increases as we move from left to right. Because of this elements of N, O, F possess very small size and high electron density. Hence incoming electron feels repulsion due to existing electrons. Because of this, electron gain enthalpy is less for second period element compared to third period of the same group (in 5th, 6th and 7th groups).