The management of oil and gas wells under high-pressure high-temperature (HPHT) conditions is a significant challenge in the oil industry, leading to increased operational and maintenance costs. One method for calculating the density of drilling fluids involves the use of sensors placed at the bottom of the well, which measure the fluid density in real time. Despite their accuracy, these sensors are costly and perform suboptimal under HPHT conditions. In the present study, seven robust machine-learning models, namely generalized regression neural networks (GRNN), wavelet neural networks (WNN), and cascade forward neural networks (CFNN) combined with two different training algorithms containing Levenberg-Marquardt and Bayesian regression (CFNN-LM and CFNN-BR), respectively, and support vector regression (SVR) models combined with three optimization algorithms containing (farmland fertility algorithm (FFA) grasshopper optimization algorithm (GOA), and particle swarm optimization (PSO) were utilized to predict mud density at HPHT conditions. Moreover, mathematical models were developed using a group data management algorithm (GMDH) to predict this parameter. WNN, SVR model combined with (PSO, GOA, FFA), CFNN, and GRNN algorithms have better adaptability than other artificial intelligence models. These models can improve performance by changing the data and different situations. Also, these models can better resistance against noisy data, which means that they can show good performance compared to uneven and discontinuous data. To this aim, using 986 experimental data of drilling fluid at HPHT, including 117 water-base fluid data, 440 colloidal gas aphron fluid data, 219 oil-base fluid data, and 210 synthetic fluid data the drilling fluid density was modeled. Input parameters including temperature, pressure, initial mud density, and volume fraction of solid content were used for modeling. The results showed that the volume fraction of the solid content as an input variable improves the accuracy of intelligent models in this work. Based on average absolute percent relative error (AAPRE) the best outcomes for predicting the mud density without the input parameter of solid fraction were observed by the PSO-SVR model with an AAPRE of 0.5569%. Following, the GOA-SVR, WNN, and FFA-SVR delivered the next best results with AAPRE of 0.5860%, 0.5786%, and 0.6148%, respectively. Moreover, with the input parameter of solid fraction, the WNN model demonstrated the highest accuracy among all models, achieving an AAPRE of 0.2475%. Also, the correlation developed using the GMDH method based on input parameters of initial mud density, temperature, and pressure yielded satisfactory outcomes and can provide precise and swift estimates. Eventually, Sensitivity analysis revealed that initial mud density had the highest impact on mud density. Lastly, the leverage analysis indicates that most data points are trustworthy based on experimentation, with only a few falling outside the PSO-SVR and WNN models' scope.