As one of the typical antibiotics, sulfamethoxazole (SMX) has attracted widespread attention because of its nonbiodegradability and persistence. Here, a novel carbon-rich graphite carbon nitride nanotube with nitrogen vacancies and highly dispersed cobalt doping (Co-CN) was prepared based on porous tubular carbon nitride (PTCN) by a simple one-step thermal polymerization method employing urea, melamine, and cobalt(II) phthalocyanine as raw materials. Characterization results showed that highly distributed Co atoms were evenly doped in the CN ring of g-C 3 N 4 . Under visible light irradiation with the assistance of peroxymonosulfate (PMS) (the Vis-PMS system), the best Co-CN catalyst showed a rate of 0.222 min −1 to SMX degradation, which was 31 times that of PTCN/Vis-PMS, with only 0.020 mg/L cobalt leaching. Further investigation showed that nonradical 1 O 2 was predominantly responsible for the SMX degradation, and h + , O 2•− , and high-valent cobalt species also made certain contributions. Therefore, neither the pH nor the anion of the solution had much of an effect on the degradation process. Moreover, the degradation pathways of SMX were proposed, and an assessment of the ecotoxicity of the resulting byproducts was also conducted. In general, this work developed a new photocatalyst for potential applications to remove organic pollutants from water and wastewater.■ HIGHLIGHTS 1. Catalyst preparation was simple and easy one-step thermal polymerization. 2. Co-CN-20 showed excellent photocatalytic performance with ultralow cobalt ions leaching. 3. The reaction mechanism dominated by nonradical oxidation made degradation almost independent of the pH and anions.