The heteroatoms (N and S) doped porous carbons (HAPCs) were prepared from sewage sludge by hydrothermal carbonization and chemical activation for the first time. The porous structures and surface properties of HAPCs were characterized by multiple techniques including SEM-EDS, TEM, BET, XRD, Raman spectroscopy and Boehm's titration. The resultant materials were showed to be naturally N and S dual-doped porous carbons (HAPCs), especially for HAPCHCl+HF obtained by HCl-HF-washing, which was typical 3D hierarchically porous structure with abundant mesopores as well as big pore diameter. Then the performance of HAPCHCl+HF on AO7 removal was determined through Response surface methodology. The results showed the adsorption behavior obeyed Langmuir isotherm model and the maximum adsorption capacity was up to 440.53 mg g-1 at 25 °C. Kinetics study revealed that the adsorption followed pseudo second-order kinetic and intra-particle diffusion was the main control step. The high removal rate of AO7 was ascribed to the unique properties of HAPCHCl+HF. The great Vmes and big pore diameter facilitated the diffusion of AO7 into the intra surface of particle. Meanwhile, the basic groups and doping of N and S made HAPCHCl+HF surface had positive charges, then strong π-π stacking interaction and electrostatic attraction contributed to the highly effective adsorption. This study indicated hydrothermal carbonization coupled with chemical activation was a cost-effective approach to prepare efficient heteroatoms doped porous carbon from sewage sludge towards azo dye contaminated wastewater treatment.