The application discloses a preparation method of a
nitrogen-containing
heterocyclic compound and an
alkali metal salt of the
nitrogen-containing
heterocyclic compound, and steps of the preparation method of the
nitrogen-containing
heterocyclic compound comprise: (1) uniformly mixing trithiocyanic acid with a first
solvent, introducing
sulfuryl fluoride gas or adding an alkenyl
sulfonyl fluoride to perform a reaction, and obtaining a crude product through a crude treatment after the reaction is finished; (2) purifying the crude product to obtain the nitrogen-containing heterocyclic compound shown in a
structural formula 1; wherein R1, R2 and R3 are each independently selected from -H, -SO2F or -CH2-(CH2) n -SO2F, n is an integer selected from 1-10, and R1, R2 and R3 are not H at the same time. The preparation method of the nitrogen-containing heterocyclic compound and the
alkali metal salt of the nitrogen-containing heterocyclic compound can be applied to a large amount of trithiocyanic acid in a
lithium battery electrolyte, raw materials are easy to obtain, operation is simple, the yield is high, the condition is mild, the requirement for equipment is low, and the method is suitable for industrial production.