In today’s modern world, any community anywhere has the right to have access to a basic level of electricity. It is with this in mind that efforts are being made to provide electric power to even the most remote locations. Solar and wind energy are examples of renewable energy sources that are both clean and versatile. For a distant rural school in south-eastern Iraq, this research presents Particle Swarm Optimization (PSO) to reduce the Cost of Energy (COE) according to maximum dependability of Hybrid Renewable Energy System (HRES), by utilizing an integrated electrical generation system. The suggested hybrid system consists of PV, WT, and BT, all of which are subject to a certain investment restriction. Results showed that, the optimal sizing of the Number of Photovoltaics (NPV) equal to (9), Number of Wind turbines (NWT) equal to (6), Number of the batteries (NBT) of (29), Cost of energy (0.536 US$/kwh), Loss power supply probability (0.091 %), reliability (99.909 %) and renewable factors (100 %) with (59 %) PV penetration, and (41 %) WT penetration. As a result, the use of the hybrid system is justified from a technological, economic, and humanitarian standpoint.