Renewable microgrids are new solutions for enhanced security, improved reliability and boosted power quality and operation in power systems. By deploying different sources of renewables such as solar panels and wind units, renewable microgrids can enhance reducing the greenhouse gasses and improve the efficiency. This paper proposes a machine learning based approach for energy management in renewable microgrids considering a reconfigurable structure based on remote switching of tie and sectionalizing. The suggested method considers the advanced support vector machine for modeling and estimating the charging demand of hybrid electric vehicles (HEVs). In order to mitigate the charging effects of HEVs on the system, two different scenarios are deployed; one coordinated and the other one intelligent charging. Due to the complex structure of the problem formulation, a new modified optimization method based on dragonfly is suggested. Moreover, a self-adaptive modification is suggested, which helps the solutions pick the modification method that best fits their situation. Simulation results on an IEEE microgrid test system show its appropriate and efficient quality in both scenarios. According to the prediction results for the total charging demand of the HEVs, the mean absolute percentage error is 0.978, which is very low. Moreover, the results show a 2.5% reduction in the total operation cost of the microgrid in the intelligent charging compared to the coordinated scheme.