Two‐dimensional mesoporous carbon nitride (MCN) with tunable pore diameters have been successfully prepared for the first time using SBA‐15 materials with different pore diameters as templates through a simple polymerization reaction between ethylenediamine (EDA) and carbon tetrachloride (CTC) by a nano hard‐templating approach. The obtained materials have been unambiguously characterized using X‐ray diffraction (XRD), N2 adsorption, high‐resolution transmission electron microscopy (HRTEM), electron energy loss spectroscopy (EELS), high‐resolution scanning electron microscopy (HRSEM), X‐ray photoelectron spectroscopy (XPS), Fourier transform infrared (FT‐IR) spectroscopy, and CHN analysis. The results show that the pore diameter of the MCN materials can be easily tuned from 4.2 to 6.4 nm without affecting their structural order. XRD, HRTEM and N2 adsorption results reveal that the materials are structurally well ordered with a two‐dimensional porous structure, a high surface area and a large pore volume. It is also demonstrated for the first time that the textural parameters such as the specific pore volume, the specific surface area and the pore diameter, and the nitrogen content of the MCN materials can be controlled by the simple adjustment of the EDA to CTC weight ratio. The carbon to nitrogen ratio of the MCN decreases from 4.3 to 3.3 with increasing EDA to CTC weight ratio from 0.3 to 0.9. The optimum EDA to CTC weight ratio required for fabricating the well‐ordered MCN materials with excellent textural parameters and high nitrogen content is around 0.45. The catalytic activity of the materials has been tested in the Friedel‐Crafts acylation of benzene using hexanoyl chloride as the acylating agent. The materials are highly active and show a high conversion and 100 % product selectivity to caprophenone.