A controllable one-pot method to synthesize N-doped ordered mesoporous carbons (NMC) with a high N content by using dicyandiamide as a nitrogen source via an evaporation-induced self-assembly process is reported. In this synthesis, resol molecules can bridge the Pluronic F127 template and dicyandiamide via hydrogen bonding and electrostatic interactions. During thermosetting at 100 °C for formation of rigid phenolic resin and subsequent pyrolysis at 600 °C for carbonization, dicyandiamide provides closed N species while resol can form a stable framework, thus ensuring the successful synthesis of ordered N-doped mesoporous carbon. The obtained N-doped ordered mesoporous carbons possess tunable mesostructures (p6m and Imm symmetry) and pore size (3.1–17.6 nm), high surface area (494–586 m2 g−1), and high N content (up to 13.1 wt%). Ascribed to the unique feature of large surface area and high N contents, NMC materials show high CO2 capture of 2.8–3.2 mmol g−1 at 298 K and 1.0 bar, and exhibit good performance as the supercapacitor electrode with specific capacitances of 262 F g−1 (in 1 M H2SO4) and 227 F g−1 (in 6 M KOH) at a current density of 0.2 A g−1.