In the water pollution prevention project, particle swarm optimization is a very practical method, which gathers multiple individuals into a group. It can effectively solve traditional problems. This paper mainly introduces the water pollution control technology and control theory and basic steps based on the characteristics of nuclear particle number and diversity, multi species clustering, etc. Then, it summarizes, analyzes and studies the existing literature on its application and shortcomings, and gives suggestions for improvement. It further explains from the design idea to the algorithm flow, and applies this method to practical projects to reduce costs while ensuring accuracy. Next, based on the research of particle swarm optimization algorithm, this paper designs the technical framework of water pollution prevention and control engineering, and conducts simulation tests on the performance of this algorithm. The test results show that in water pollution prevention and control engineering, through the comparative analysis of the performance of particle swarm optimization algorithm, it is found that the particle swarm optimization algorithm has a fast running time and high iteration efficiency, because it has good global optimization ability, And its performance is also very stable and reliable. Therefore, these factors should be fully considered and utilized in the design process to improve the technical level of water pollution treatment so as to achieve the goal of environmental protection in a real sense.