Optimizing fracture fluid viscosity in a high salinity medium (i.e., seawater and produced water) is challenging. Hence, we conducted numerous rheology experiments utilizing an Anton Paar rheometer to generate viscosity data. We have experimented with different types and concentrations of polymers, crosslinkers, and chelating agents in different water salinities at different shear rates, temperatures, pressures, and mixing orders. After data cleaning, the study generated 645 data from 86 experiments, which were fed to the machine learning (ML) models such as fully connected neural networks (FCNN), gradient boosting (GB), adaptive gradient boosting (AdaBoost), extreme GB (XGB), random forest (RF), and decision trees (DT). The hyper-parameters of these models were optimized using a grid search optimization approach during the training phase. Additionally, the K-fold crossvalidation technique was utilized to enhance the models' performance of the ML. The performance of the ML models was assessed through various assessment tests, such as root mean square error (RMSE), coefficient of determination (R 2 ), average absolute percentage error (AAPE), and cross-plots. The outcomes of the predictions indicated that the feedforward neural network (FCNN) outperformed the DT, RF, GB, AdaBoost, and XGB models. These techniques yielded remarkably low error rates. With the optimal settings, the fracturing fluid viscosity was predicted with 95% accuracy. In addition, the fracturing fluid viscosity was maximized using the particle swarm optimization algorithm by optimizing the input parameters where the FCNN model was trained. The proposed methodology of predicting the fracturing fluid viscosity could minimize the experimental cost of measuring fracturing fluid rheology.