To search for potential n-type diamonds with shallow donor energy levels and low formation energies, the reaction energies, geometries, formation energies, electronic properties of hydrogen (H) and nitrogen (N) co-doped diamond have been investigated by density functional theory (DFT) and hybrid density functional theory (HSE06). The results of the investigations on isolated H- and N-doped diamonds do not meet the criteria for shallow n-type donors, in agreement with previous findings. Subsequently, the effect of the addition of N atoms as a co-dopant with H is investigated, which varies with the H:N ratio and whether H is substitutional or interstitial. By the results of the electronic structure, it is found that only the HN4 co-doped diamond is likely to exhibit a shallow donor, with a shallow donor level of 0.147 eV and formation energy of 0.02 eV. Then, the stability of the HN4 defect is analyzed, and the HN4 defect is more stable compared to the H-N3 + N and H-N2 + N2 defects, and its decomposition energy is also very large. Further, the bond strain brought by HN4 defect is considered, showing that the local bond strain of the HN4 defect is intermediate between that of the boron (B) and N defects, which proves that the defect can be realized. Finally, a non-molecular synthetic route for the preparation of HN4 defect is proposed by combining H-N + N3V or N2 + H-N2 defects.