In this study, using first-principles calculations, we investigate the behavior of electrons at the SiC/SiO$_2$ interface when nitrogen is introduced as a dopant within a few nm of the SiC surface. When a highly doped nitrogen layer (5$\times$10$^{19}$ cm$^{-3}$) is introduced within a few nm of the SiC(11$\bar{2}$0) surface, the electronic state is not significantly affected if the doping region is less than 4 nm. However, if the doping region exceeds 4 nm, the effect of quantum confinement decreases, which increases the electron density induced in the inversion layer. As for the wave function, even when an electric field is applied, the peak shifts toward the direction in which the electrons are pulled away from the interface. This reduces the effect of electron scattering at the interface and improves electron mobility.