Hydrogen sulfide (H₂S) poses substantial risks to human safety and infrastructure due to its toxicity and corrosive properties. In this study, we present a novel approach to enhance the selective catalytic oxidation of H₂S by synthesizing a nitrogen-doped mesoporous carbon catalyst (denoted as M/B-X-PZ-T) through pyrolysis at 600–800 °C. Our catalyst, derived from commercial biochar, incorporates melamine as a nitrogen source and employs KCl and ZnCl₂ as porogens via the salt-templating method. The resulting catalyst, M/B-1-PZ-700, exhibits an impressive specific surface area of up to 1269.77 m²/g and a high mesopore ratio, with effective nitrogen doping reaching up to 15.35 at%. Remarkably, M/B-1-PZ-700 demonstrated exceptional performance, achieving 100 % H₂S conversion and 94 % sulfur selectivity at 170 °C, surpassing previous nitrogen-doped carbon catalysts. Furthermore, our optimized catalyst maintained over 95 % H₂S conversion and superior sulfur yield for 36 h, indicating excellent long-term stability. This metal-free catalyst derived from biochar offers a promising, sustainable, and eco-friendly solution for effectively mitigating hazardous H₂S emissions.