Why does water vapour deviate much more from ideal gas behaviour as it is cooled compared to nitrogen gas?
Well, an ideal gas has no attraction force between its molecules and does not have a boiling point, as you cannot make it liquid. Also, the sum of  molecule own volumes is supposed negligible wrt the gas volume.

Water does not form anything close to an ideal gas because of its hydrogen bonds.  You have to heat water to 100 °C to make it boiling to overcome these bonds between molecules of liquid water. Molecules of water vapour interacts with each other as well, especially at  high pressure.

If water had not had these bonds, it would have reportedly boiled at -120 °C. And if water had not been polar, what makes intermolecular attraction as well, its boiling point would  have been comparable with nitrogen.

Nitrogen is a non polar gas, with minimal molecular attraction, compared to water, due weak van Der Waals force, which leads to nitrogen boiling at -196 °C.