An accurate, sensitive, low-cost, portable, and easy-to-use method for the quantitative detection of Clostridium perfringens (Cp), a zoonotic pathogen widely found in nature and capable of spreading through contaminated food or environments, is essential for epidemiology, prevention, and diagnostics. Here, we have designed a smartphone-based electrochemical DNA biosensor, which utilizes carboxyl-functionalized multi-walled carbon nanotubes (COOH-MWCNTs) as the substrate, L-cysteine (L-Cys) as the linker, and a synergistic modification of the bioelectrode with gold nanoparticles (AuNPs) and polyamidoamine dendrimers (PAMAM). This design enables highly sensitive, low-cost, label-free, and portable detection of the cpb2 gene in Cp. The sensor not only enhances detection performance but also improves convenience and practicality. Differential pulse voltammetry (DPV) was used to monitor the electrochemical signal response to changes in target DNA concentration, enabling the tracking of the DNA hybridization process. Under optimized conditions, the biosensor exhibited a linear detection range from 10⁻14 to 10⁻⁸ M, with a detection limit of 1.5 fM. It demonstrated excellent selectivity for the cpb2 gene and was successfully applied to detect variations in cpb2 gene content in wastewater and fecal DNA samples. Compared with the traditional method, the detection time of this method is short, the operation of professional and technical personnel is not required, the instrument is small and portable, and the single detection cost is significantly reduced. This study provides a new strategy for the rapid, portable, and highly sensitive detection of bacterial toxin genes in livestock and aquaculture.