The thermal treatment of an activated carbon/chars with a nitrogen precursor is not a sustainable nor an efficient method for the incorporation of N into the carbon structure. This study proposes the use of hydrothermal carbonization (HTC) as an environmentally friendly method for the incorporation of N into the bulk of carbon materials. The authors propose the following sequence for the synthesis of Nenriched carbon materials (NCM) for energy storage applications: HTC of the N precursor and biomass ! activation of N-hydrochar (N-HC). To investigate the proposed method, HTCs of spent coffee grounds (SCG) with N precursors (urea and alanine) were conducted at 220 C for 5 hours. The resulted N-HCs were subjected to a mild thermal activation via pyrolysis at 600 C for 2 hours. The results showed that HTC enhances the incorporation of N into the carbon matrix via many reactions, for example, the Maillard reaction (MR) or the Mannich reaction, which may accompany the formation of HC via the solved-intermediate pathway or the solid-to-solid pathway, respectively. However, adjusting some parameters before HTC, for example, the concentration of the N precursor and the pH value of the slurry is important to avoid a significant reduction in the N-HC yield. The proposed method led to the synthesis of NCM with a N content of 10.3wt% The X-ray photoelectron spectroscopy (XPS) confirmed the incorporation of N into the bulk of NCM and showed a significant increase in the content of heterocyclic N compounds (pyridinic N, pyrrolic N, and graphitic N) in the NCM. The incorporation of N via the proposed method significantly improved the electrochemical properties of NCM as the values of the specific capacitance and the electrical conductivity in the NCM increased by five times and four times, respectively.