Using the first principles density functional theory, diamond crystal doping with B or N atoms, and B/N with different ratios were investigated, based on previous experimental structure results. The formation energies were calculated while the most stable doped structures were obtained for the lowest energy. For comparison, the electronic structures and the micro-mechanism of the doping crystals were discussed. The electronic results show that the doping of N atom is prior to B while the symmetry B–N–B stable structure appears with the N:B = 1:2 doping ratio. And also, the absorption spectrum gives the same results with the experiment for the distinct redshift.