Dye sludge is a major by-product and it will bring critical environmental problems in the textile industry. In this study, dicyandiamide formaldehyde resin (DFR) is used as an effective flocculating agent for the removal of anionic dyes from textile dye wastewater. Employing dye-contaminated sewage sludges as precursors, N, S dual-doped carbon materials are successfully synthesized by using DFR as a soft template. The specific surface area, morphology, and pore structure of the resulting annealed products can be easily controlled by changing the DFR content of the dye sludge. The oxygen reduction reaction performance of optimal carbon material (N, S-DF-2) is close to commercial 20% Pt/C in alkaline medium, including onset potential (0.98 V), half-wave potential (0.82 V), as well as limiting current density (5.46 mA·cm−2). Furthermore, it also shows better durability and crossover resistance. In addition, N, S-DF-2 exhibits a large specific capacitance (230 F·g−1 at 1 A·g−1) and super capacitance retention (nearly 98% at 10 A·g−1) after 2500 cycles as supercapacitors electrodes. This work opens up a new method to take full advantage of organic polymeric flocculant as a soft template to prepare N, S dual-doped carbon materials, which will be beneficial for the reuse and recycling of sewage sludge, as well as for the production of good quality energy conversion and storage materials.