The invention relates to a boron-nitrogen doped pine compound and a preparation method thereof. The structural formula of the compound is: in the formula, R is phenyl, methylphenyl, tert-butylphenyl, trifluoromethylphenyl, bis(trifluoromethyl)phenyl, mesityl, naphthyl, etc.; R' is H, C4-C18 alkyl, phenyl, methylphenyl, methoxyphenyl, fluorophenyl, trifluoromethylphenyl, tert-butylphenyl, naphthyl, benzyl, ring Hexyl, pyridyl, thienyl or 2,4,6-trimethylphenyl, etc. The boron-nitrogen-doped pine compound of the present invention has good thermal stability, and the fluorescence emission spectrum in an organic solvent has strong fluorescence in the range of 380-500 nm, and its band gap can be opened after boron-nitrogen doping , and has great application prospects in the fields of hydrogen storage, biomedicine, coordination chemistry, catalysis, and electronic devices.