Co-pyrolysis of sewage sludge and rice husk is a promising sludge treatment and resource utilization method. In this work, the pyrolysis conditions of sewage sludge and rice husk were optimized to obtain the optimal biochar (OB) with the highest capacity for Direct Red 23 (DR23). Adsorption isotherm, kinetics, thermodynamics and mechanism of DR23 onto OB and modified OB by oxalic acid (OAOB) were also investigated. Results revealed that the pyrolysis temperature (651.444 degrees C), heating rate (10 degrees C/min), and residence time (4.683 h) were the best preparation conditions of biochar for adsorption of DR23; OB and OAOB both have high adsorption capacities towards DR23: 313.48 and 336.70 mg/g, respectively; The adsorption data fitted the Freundlich, Langmuir and Temkin models well, the adsorption kinetics obeyed pseudo-second-order model, and the sorption was spontaneous and endothermic; Adsorption mechanisms of DR23 onto OB and OAOB were mainly chemisorptions and contained functional group interaction between -OH, -COOH on surface of OB with DR23, and between -OH, -COOH, -COOR on surface of OAOB with DR23, pi-pi stacking interaction, electrostatic interaction and surface participation. This work was beneficial for the resource utilization of sludge and rice husk, and provided targeted adsorbent for the removal of DR23 from wastewater.