In the electronic configuration of nitrogen we found that there are 2 electrons present in the 1s orbital and 2 electrons present in the 2s orbital. But in case of 2p orbital there are only 3 electrons present i.e. it is half filled (condition for full filled is 6). This type of half filled orbitals are very much stronger than any other configuration( like oxygen has 4 electrons in its 2p orbital ) and more amount of energy is required to remove an electron from 2pz subshell of 2p orbital. So nitrogen has the higher I.E. than oxygen.