Microgrid (MG) is the basic element that recreates a significant role in integrating renewable energy sources (RES). Direct current (DC) MG has advantages over alternating current (AC) for many applications. A DC-MG is connected to the islanded mode through power electronic converters, which are also an important component for RES integration. Due to environmental factors, RES will struggle to load the conditions. Branches of DC-MG have battery energy storage systems (BESSs) installed for compensating the supply–load imbalance. Even though BESS are installed, accurate maintenance is still required to maintain a balanced power flow. This work proposes an adaptive deep Q-learning (DQL) based mud ring optimization technique (DQMR) for optimal power flow in islanded DC-MG. DQL is effective for the task with discrete and low-dimensional action spaces, and mud ring algorithm (MRA) is to clear up large-scale optimization problems and power flow problems. The implementation is done through MATLAB/Simulink model. The error is minimized to 6% by this method, and the losses are also reduced. IEEE-9 bus system and IEEE-30 bus system are used in the proposed work to validate the performance.