Current flocculation and sterilization are two separate steps that can cause environmental and economic problems. Lignin, an inedible industrial by-product, as raw material to prepare polymer that simultaneously realize flocculation and sterilization is of great significance for carbon neutral, sewage recycling, and economic benefit. However, the inherent defects of lignin such as heterogeneity, poor solubility and low reactivity cause difficulty in preparing and applying lignin-based polymers. Under this context, an energy-saving synergistic technology incorporating lignin refining and photoinitiated biphasic copolymerization system was pioneered, and an ultra-efficient dual-function lignin-based polymer with hyperbranched amphiphilic structure was successfully prepared, which contributed to 99.6% removal rate and distinguished sterilization effect for E. coli suspension at an ultra-low dose (4 mg/L and 10 mg/L, respectively). The purification mechanism indicated that the first flocculation was attributed to the synergy of charge attraction, bridging and sweeping, while the subsequent sterilization was achieved by blocking the metabolism and changing membrane permeability. The examination on various external influencing factors showed great adaptability of this lignin-based polymer to complex sewage environment with superiority over existing commercial products.