The combination of water management and urban planning can promote the sustainable development of cities, which can be achieved through buildings’ absorption and utilization of pollutants in water. Sulfate ions are one of the important pollutants in water, and concrete is an important building material. The absorption of sulfate ions by concrete can change buildings’ bearing capacity and sustainability. Nevertheless, given the complex and heterogeneous nature of concrete and a series of chemical and physical reactions, there is currently no efficient and accurate method for predicting mechanical performance. This work presents a deep learning model for establishing the relationship between a water environment and concrete performance. The model is constructed using an experimental database consisting of 1328 records gathered from the literature. The utmost essential parameters influencing the compressive strength of concrete under a sulfate attack such as the water-to-binder ratio, the sulfate concentration and type, the admixture type and percentage, and the service age are contemplated as input factors in the modeling process. The results of using several loss functions all approach 0, and the error between the actual value and the predicted value is small. Moreover, the results also demonstrate that the method performed better for predicting the performance of concrete under water pollutant attacks compared to seven basic machine learning algorithms. The method can serve as a reference for the integration of urban building planning and water management.