The invention discloses a preparation method of lamellar porous carbon nitride, which uses carbon and nitrogen precursors, dyes and water as raw materials, and adopts dye-assisted hydrothermal treatment of conventional carbon and nitrogen precursors to prepare modified precursors; then the above modified Precursors are calcined at high temperature to obtain lamellar porous carbon nitride. The obtained carbon nitride has an obvious two-dimensional lamellar porous structure with uniform pore size distribution, which not only effectively increases the specific surface area of the material and thus increases the reactive sites, but also realizes the regulation of the energy band structure of the material and optimizes the optical efficiency. Reaction potentials for reduction and photooxidation, compared with conventional nonporous, agglomerated bulk g‑C 3 N 4 exhibited good photocatalytic performance. In addition, the present invention has the advantages of simple procedures, wide sources of raw materials, low cost, strong experimental operability, and no special requirements for equipment, which fully meets the current industrial-grade requirements of non-toxic, environmentally friendly, simple, and low-cost, and is suitable for large-scale industrialization Production.