The ionization energy of nitrogen is more than that of oxygen because
Nitrogen has half filled p-orbitals
Nitrogen is left to the oxygen in the same period of the periodic table
Nitrogen contains less number of electrons
Nitrogen is less electronegative
As we have learnt,
Half filled and fully filled orbital configurations have more stability and as a result have a greater value for their Ionisation energy.
Now, since N has a half filled p orbital configuration, its ionisation energy is greater than O.
Study 40% syllabus and score up to 100% marks in JEE