Abstract Photocatalysis is an effective solution to degrade organic dye discharge in wastewater treatment due to its efficiency, environmental friendliness and cost‐effectiveness. However, issues such as limited visible light absorption and rapid charge carrier recombination hinder its practical use. In this research, the heterojunction (Co─FCN) composed of carbon fluoride nitride and cobalt tetroxide (Co 3 O 4 ) was successfully prepared by a simple one‐pot pyrolysis method. The obtained nanocomposites showed their efficiency as photocatalyst in the photodecomposition of Rhodamine B (RhB). The relationship between microstructure and properties of photocatalyst was studied in detail by means of characterization techniques. The results showed that the RhB degradation efficiency of Co 3 ─FCN was 92.91% within 60 min irradiation time. The results of free radical scavenging experiments show that superoxide anion (·O 2− ) and hydroxyl radical (·OH) are the main active species in Co─FCN composite catalysts. In addition, the potential degradation pathway of RhB was inferred based on the intermediates detected by liquid chromatography mass spectrometry (LC‐MS), and the preliminary photocatalytic reaction mechanism of Co─FCN heterogeneous catalyst was constructed accordingly. Therefore, this research provides new insights into the preparation and modification of CN photocatalysts, thereby promoting the application potential of efficient photocatalysts in the degradation of organic pollutants.