Nanomaterials with intrinsic enzyme-like activity have gained substantial scientific attention as viable substitutes to natural biological enzymes owing to their cheap price and great stability. Numerous artificial enzyme mimics have been employed effectively in sectors such as sensing, environmental processing, and cancer treatment. In this study, novel nitrogen-doped porous carbon nanomaterials (CPs) were produced by modifying polypyrrole with magadiite using chemical oxidative polymerization and calcination methods. The obtained nitrogen-doped porous carbon nanomaterials exhibited improved peroxidase-like activity, which catalyzed the oxidation of 3,3,5,5-tetramethylbenzidine (TMB) in the presence of hydrogen peroxide (H2O2) to produce colorful compounds. Kinetic investigation revealed that the affinity for TMB of nitrogen-doped porous carbon peroxidase mimics was higher than that of genuine horseradish peroxidase (HRP). In addition, a sensitive assay with encouraging performance for the colorimetric detection of ascorbic acid (AA) was successfully fabricated employing nitrogen-doped porous carbon nanomaterials as peroxidase mimics. The results were satisfactory and demonstrated its potential application in antioxidant detection.