In treating complex sewage containing microorganisms, flocculation and disinfection typically occur as distinct stages, involving the addition of flocculants and disinfectants separately. To integrate oil removal and disinfection, a novel quaternary ammonium-hydrophobic ternary template polymer, TPAMA-DA, was engineered with capabilities for both flocculation and sterilization functions. Optimal copolymer characteristics were determined through Response Surface Methodology of the preparation parameters for TPAMA-DA. The copolymer prepared was applied to model wastewater, and the results indicate that, in emulsified oil and E. coli single systems, TPAMA-DA achieved removal rates of 95.71 % and 97.19 % for emulsified oil and OD600 (residual OD600 = 0.0239), respectively, showcasing superior oil removal and antibacterial capabilities compared to TPAMA and PAMA. Meanwhile, TPAMA-DA exhibited excellent oil removal efficiency across a broad range of pH environments, contrasting sharply with its pH-sensitive antibacterial properties. Surprisingly, applying TPAMA-DA to the oil-E. coli binary systems, it not only maintained high efficiency in oil removal but also showed certain pH adaptability in antibacterial activity, suggesting TPAMA-DA’s outstanding ability for simultaneous oil removal and antibacterial action in oil-E. coli binary systems. Impressively, SEM and 3D-EEM analyses confirm that TPAMA-DA disrupts the bacterial cell, resulting in the death of E. coli. These findings may pave the way for new avenues in the development of multi-functional, efficient, low-consumption, and environmentally friendly high-performance copolymers with dual capabilities for oil removal and sterilization.