The laser-like coherent emission at 391nm from N$_2$ gas irradiated by strong 800nm pump laser and weak 400nm seed laser is theoretically investigated. Recent experimental observations are well simulated, including temporal profile, optical gain and periodic modulation of the 391nm signal from N$_2^+$. Our calculation sheds light on the long standing controversy on whether population inversion is indispensable for the optical gain. We demonstrate the Ramsey interference fringes of the emission intensity at 391nm formed by additionally injecting another 800nm pump or 400nm seed, which are well explained by the coherent modulation of transition dipole moment and population between the $A^2Pi_u( u=2)$-$X^2Sigma_g^+$ states as well as the $B^2Sigma_u^+ ( u=0)$-$X^2Sigma_g^+$ states. This study provides versatile possibilities for the coherent control of $text{N}_2^+$ air laser.