Although N-doped carbon has attracted much attention due to its excellent performance in chloramphenicol (CAP) detection of dairy products, traditional fossil energy sources are costly to develop and environmentally unfriendly. Therefore, in this paper, corn straw biogas residue was selected to prepare biochar, which was an excellent electrode material with simple preparation, high specific surface area, rich pore structure, and good electrical conductivity. A simple, fast and sensitive voltammetric sensor for CAP detection was prepared by using biogas residue biochar and dopamine hydrochloride as raw materials to prepare a biogas residue biochar @polydopamine (BRB@PDA) composite modified glassy carbon electrode and electrodepositing 8-cyclodextrin (8-CD) onto the modified electrode. The electrochemical performance of the bare glassy carbon electrode (GCE), 8-CD/GCE, BRB@PDA/GCE and 8-CD/BRB@PDA/GCE modified electrodes showed that BRB@PDA had excellent electrical conductivity and the deposition of 8-CD and BRB@PDA on the electrode surface significantly improved the electron transfer performance. The linear concentration range of the sensor was 5.0 x 10-7-5.0 x 10-4 mol L-1 with a detection limit of 2.0 x 10-8 mol L-1 (S/N = 3), and it showed good reproducibility, satisfactory sensitivity and high specificity. The good accuracy and reliability of 8-CD/BRB@PDA/GCE were demonstrated by spiked recovery experiments. Based on the hydrogen bonding between the hydroxyl groups of 8-CD/BRB@PDA/ GCE, a significant electrochemical signal could be obtained for the detection of chloramphenicol in dairy products. The results reflected the electrochemical performance of the digestate biochar and also indicated that the digestate biochar material had good application prospects in electrochemical detection.