The invention relates to the technical field of flame retardants, and discloses a nitrogen-phosphorus flame retardant and a preparation method thereof. The nitrogen-phosphorus flame retardant comprises the following components in percentage by weight: 5%-10% of a nano flame retardant, 5%-8% of a nitrogen-phosphorus flame retardant, 5%-10% of a vulcanizing agent, 3%-5% of hydrotalcite, 5%-10% of montmorillonite, 10%-15% of zirconium phosphate, 1%-5% of graphite oxide, 5%-10% of a flame-retardant synergist, 1%-5% of boric acid, 2%-5% of zinc borate, 1%-5% of boron phosphate, 5%-9% of silicon dioxide, 1%-5% of aluminum hydroxide, 1% 4% of magnesium hydroxide, 2%-5% of phosphorus oxychloride, 3%-6% of molybdenum disicide and 4%-8% of pyrophosphoric acid. The nano flame retardant is crushed by the crusher, water is added into the nitrogen-phosphorus flame retardant for mixing, the hydrotalcite is heated, the silicon dioxide is crushed by the crusher, and the graphite oxide is ground by a grinding machine. The nitrogen-phosphorus flame retardant and the preparation method thereof have the advantages that the nitrogen-phosphorus flame retardant is convenient to stretch, the breaking strength of the flame retardant is high, the production cost is reduced, the process steps are simplified, the production efficiency is improved, and large-scale production is convenient.