Regarding the increasing need for water resources and the decline of surface water resources, awareness of these resources is a crucial need in planning, developing, and protecting them. This research was conducted to model the water quality index (the most widely used feature of determining water quality) using machine learning models (Random Forest and Support Vector Machine) in the Zayandehrood River. Regarding the large number of water quality indices, the NSFWQI index was used in this study. First, this index was calculated, and then, input data, including water quality characteristics of 8 stations over 31 years, and the river water quality index were used. In this research, 80% of the data was used in the training stage, and the remaining 20% was used in the evaluation stage. The optimal model was selected based on the evaluation criteria, including R2, CRM, and NRMSE. The results showed that the Support Vector Machine algorithm (0.931 < R² < 0.982, 1.321