Sulfonamide antibiotics are frequently detected in livestock wastewater, seriously harming the ecological environment and human health. Boron-doped diamond (BDD) electrochemical process has prominent potential in degrading organic pollutants from special industrial wastewater. In this work, the degradation efficiency and mechanism for sulfadiazine (SDZ) with the prepared BDD electrode were investigated. Scanning electron microscopy (SEM) and Raman spectroscopy revealed a 2 μm thick, compact, and crack-free BDD film on silicon. The BDD's oxygen evolution potential was 1.47 V. About 93.3 % of SDZ in the synthetic wastewater was removed under the conditions of a current density of 40 mA/cm2, electrode spacing of 20 mm, electrolyte concentration of 40 mM, and an initial pH of 8. Hydroxyl radical and direct electron transfer (DET) mainly contributed to SDZ degradation based on specific quencher tests and electrochemical analysis. The possible transformation pathways of SDZ were proposed according to the detected oxidation products and DFT calculation, mainly including amino hydroxylation, sulfur dioxide extrusion, and pyrimidine heterocyclic ring opening. Furthermore, the toxicity of intermediates products markedly weakened compared to that of SDZ. The presence of ion chloride could slightly improve the removal of SDZ, while bicarbonate and phosphate inhibited the SDZ degradation. In addition, the efficient removal of chemical oxygen demand and SDZ in the effluent of aerobic biological treatment effluent of actual livestock wastewater was confirmed. To sum up, BDD electrochemical oxidation is a viable approach for the advanced treatment of livestock wastewater.