In the current era of e-mobility and for the planning of sustainable grid infrastructures, developing new efficient tools for real-time grid performance monitoring is essential. Thus, this paper presents the prediction of the voltage stability margin (VSM) of power systems by the critical boundary index (CBI) approach using the machine learning technique. Prediction models are based on an adaptive neuro-fuzzy inference system (ANFIS) and its enhanced model with particle swarm optimization (PSO). Standalone ANFIS and PSO-ANFIS models are implemented using the fuzzy ‘c-means’ clustering method (FCM) to predict the expected values of CBI as a veritable tool for measuring the VSM of power systems under different loading conditions. Six vital power system parameters, including the transmission line and bus parameters, the power injection, and the system voltage derived from load flow analysis, are used as the ANFIS model implementation input. The performances of the two ANFIS models on the standard IEEE 30-bus and the Nigerian 28-bus systems are evaluated using error and regression analysis metrics. The performance metrics are the root mean square error (RMSE), mean absolute percentage error (MAPE), and Pearson correlation coefficient (R) analyses. For the IEEE 30-bus system, RMSE is estimated to be 0.5833 for standalone ANFIS and 0.1795 for PSO-ANFIS; MAPE is estimated to be 13.6002% for ANFIS and 5.5876% for PSO-ANFIS; and R is estimated to be 0.9518 and 0.9829 for ANFIS and PSO-ANFIS, respectively. For the NIGERIAN 28-bus system, the RMSE values for ANFIS and PSO-ANFIS are 5.5024 and 2.3247, respectively; MAPE is 19.9504% and 8.1705% for both ANFIS and PSO-ANFIS variants, respectively, and the R is estimated to be 0.9277 for ANFIS and 0.9519 for ANFIS-PSO, respectively. Thus, the PSO-ANFIS model shows a superior performance for both test cases, as indicated by the percentage reduction in prediction error, although at the cost of a higher simulation time.