Freshwater quality and quantity are some of the fundamental requirements for sustaining human life and civilization. The Water Quality Index is the most extensively used parameter for determining water quality worldwide. However, the traditional approach for the calculation of the WQI is often complex and time consuming since it requires handling large data sets and involves the calculation of several subindices. We investigated the performance of artificial intelligence techniques, including particle swarm optimization (PSO), a naive Bayes classifier (NBC), and a support vector machine (SVM), for predicting the water quality index. We used an SVM and NBC for prediction, in conjunction with PSO for optimization. To validate the obtained results, groundwater water quality parameters and their corresponding water quality indices were found for water collected from the Pindrawan tank area in Chhattisgarh, India. Our results show that PSO–NBC provided a 92.8% prediction accuracy of the WQI indices, whereas the PSO–SVM accuracy was 77.60%. The study’s outcomes further suggest that ensemble machine learning (ML) algorithms can be used to estimate and predict the Water Quality Index with significant accuracy. Thus, the proposed framework can be directly used for the prediction of the WQI using the measured field parameters while saving significant time and effort.