In recent years, one of the primary causes of high electricity consumption is the growing global population and the availability of power‐demanding smart devices. As a result, accurate load forecasting tools are required for effective energy conservation in microgrids. Various simulation tools and artificial intelligence (AI)‐based methods have been used to make the best forecasts of electricity demand. Furthermore, conventional systems are static and based solely on historical data. To address this practical need, this work aims to create a machine learning (ML) model for short‐term load forecasting based on feature selection and parameter optimization. This research proposes a hybrid short‐term load demand prediction approach that combines an adaptive barnacle‐mating optimizer (ABMO) and an artificial neural network (ANN). When compared to the regression tree (RT), support vector machine (SVM), ANN, and particle swarm optimization‐based ANN (PSO‐ANN) algorithms, the proposed ABMO‐ANN algorithm reduces mean absolute percentage errors by 67.69%, 64.58%, 59.18%, and 42.02%, respectively. Compared to conventional RT, SVM, ANN, and PSO‐ANN algorithm, the hybrid ABMO with ANN outperforms them based on mean absolute percentage error, root mean square error, correlation coefficient , symmetric mean absolute percentage error, and agreement index (d).