To enhance the sustainability of microalgae-based swine wastewater treatment, this study aims to address the challenges of low efficiency in treating raw swine wastewater, collection difficulties, and high energy consumption treatment processes. The microalgae with strong environmental tolerance were first screened from swine wastewater, and its cultivation conditions were optimized to examine the effect of microalgae treatment on swine wastewater under optimal cultivation conditions. Additionally, the flocculation efficiency and mechanism of microalgae were analyzed. The results showed that Tetradesmus cf. obliquus ZYY1 exhibited the most robust heterotrophic growth. In the BG11 medium supplemented with glucose, the growth rate of T. cf. obliquus ZYY1 under chemoheterotrophic conditions was superior to its growth under photoheterotrophic conditions, reaching its peak with an optimal glucose concentration of 15 g/L. The biomass concentration of T. cf. obliquus ZYY1 in raw wastewater was significantly higher than that in sterilized wastewater, which reached 1.65 ± 0.01 g/L on the 10th day of treatment, with removal efficiencies of -N, -P, and the chemical oxygen demand reached 71.36%, 96.09%, and 93.13%, respectively. After raw wastewater treatment, the flocculation efficiency of T. cf. obliquus ZYY1 reached 97.71 ± 5.81%. This was attributed to the bacteria present in the raw wastewater, which induced T. cf. obliquus ZYY1 to secrete aromatic proteins. This study emphasizes the potential of microalgae as a green technology for sustainable wastewater treatment, offering a practical pathway for environmental protection and resource conservation.