Optical conductivity of a moderately disordered superconducting NbN film was investigated by terahertz time-domain spectroscopy in external magnetic field applied along the film plane. The film thickness of about 5 nm was comparable with the coherence length, so vortices should not form. This was confirmed by the fact that no marked difference between the spectra with terahertz electric field set perpendicular and parallel to the external magnetic field was observed. Simultaneous use of Maxwell-Garnett effective medium theory and the model of optical conductivity by Herman and Hlubina proved to correctly reproduce the terahertz spectra obtained experimentally in a magnetic field of up to 7 T. This let us conclude that the magnetic field tends to suppress the superconductivity, resulting in an inhomogeneous state where superconducting domains are enclosed within a normal-state matrix. The scattering rate due to pair-breaking effects was found to linearly increase with magnetic field.