###### Abstract  
In river and lake ecosystem management, comprehensive water quality monitoring is crucial. Traditional in situ water quality monitoring is costly, and it is challenging to cover entire water bodies. Remote sensing imagery offers the possibility of efficient monitoring of water quality over large areas. However, remote sensing data typically contain a large amount of noise and redundant information, making it difficult for models to capture the effective spectral information and the relationships in the water quality in the remote sensing data. Consequently, this hinders the achievement of high-precision water quality inversion performance. Therefore, this study proposes a comprehensive water quality inversion framework based on a multilayer denoising autoencoder that automatically extracts effective spectral features, utilizing a multilayer denoising autoencoder to extract effective features from Sentinel-2 remote sensing data, thereby reducing noise in the subsequent model input data and mitigating the overfitting problem in subsequent models. A bagging ensemble learning model was established to invert the total phosphorus concentration in Taihu Lake. This model reduces the prediction bias generated by a single machine learning model and was compared with decision tree, random forest, and linear regression models. The research results indicate that compared to a single model, the bagging ensemble learning model achieved better water quality retrieval results, with a coefficient of determination of 0.9 and an MAE of 0.014, while the linear regression model performed the worst, with a coefficient of determination of 0.42. Additionally, models trained using spectral effective information extracted by multilayer denoising autoencoders showed improved water quality retrieval accuracy compared to those trained with raw data, with the coefficient of determination for the bagging model increasing from 0.62 to 0.9. This study provides a rapid and accurate method for large-scale watershed water quality monitoring using remote sensing data, offering technical support for applying remote sensing data to watershed environmental management and water resource protection. m 2024 support for the daily environmental management of water bodies and emergency response to unexpected events. It also plays an important role in water environment pollution control and ecological restoration [7; 8]. Total phosphorus, as one of the important indicators for assessing the health status of water bodies, can lead to eutrophication and disrupt the balance of ecosystems when present in high concentrations. Therefore, monitoring total phosphorus is crucial for analyzing the health status of water bodies. Traditional water quality monitoring usually involves various chemical and instrumental analysis methods in laboratories to analyze the water samples collected. However, this method is costly and time-consuming [9]. Additionally, traditional water quality detection is limited to in situ detection and cannot achieve comprehensive water quality monitoring of large-scale water bodies [10]. In contrast, the use of remote sensing data enables efficient monitoring of water quality in large-scale water bodies [11; 12], providing data support for basin environmental management. A series of studies have successfully applied remote sensing data to water quality inversion [13; 14; 15; 16; 17]. Currently, there are relatively many studies using remote sensing data to retrieve water quality parameters for optically active substances such as chlorophyll-a, and the accuracy of related retrieval models is relatively high. However, for non-optically active substances, effective models still need to be developed to achieve high-precision water quality retrieval. Total phosphorus, as a non-optically active substance, presents significant challenges in its inversion using remote sensing data.