Enterotoxigenic Escherichia coli (ETEC) is a major pathogen causing neonatal diarrhea in livestock, with antibiotics commonly used for control. However, antibiotic overuse has led to issues such as residues and bacterial resistance, underscoring the need for alternative prevention strategies. This study investigated the potential of Bacillus safensis (B. safensis) M01, isolated from healthy porcine feces in Shandong, China, to prevent ETEC infections. M01 exhibited over 80% inhibition of ETEC in vitro and was selected for further analysis. Pre-treatment of IPEC-J2 cells with M01 significantly reduced ETEC-induced cellular damage, enhanced cell viability, and inhibited bacterial adhesion. It modulated inflammatory responses by down-regulating IL-1 beta and TNF-alpha while up-regulating IL-10. Additionally, M01 promoted the expression of tight junction proteins, including Claudin-1, Occludin, and ZO-1. In the C57BL/6 mouse model, pre-feeding with M01 for 14 days improved jejunal injury caused by ETEC, as indicated by increased villus height/crypt depth ratios. Similar to in vitro findings, M01 reduced IL-1 beta and TNF-alpha expression while enhancing tight junction protein levels. These results suggest that B. safensis M01 is a promising probiotic candidate for preventing ETEC infections in livestock, offering an effective alternative to antibiotics.