This research work proposed an optimal hybrid microgrid design for Riphah International University (RIU), Lahore, Pakistan, that ensures a continuous and affordable energy supply by harnessing reliable energy sources. The design factors in various considerations such as energy resource availability, environmental sustainability, and financial viability. The proposed hybrid renewable energy system integrates the national grid, solar photovoltaic (PV) technology, a battery bank, and a converter to fulfill the energy requirements of RIU. In order to develop the most efficient design, various factors are taken into account, including electrical load, solar irradiation, ambient temperature on campus, lifespan and efficiency of PV modules, degradation factor, cost considerations, battery longevity, energy prices from the national grid, occurrences of load shedding, and the environmental impact in terms of toxic emissions. The net present cost (NPC) factor is also considered to make the design more cost effective. The simulations conducted using HOMER Pro software yielded 932 possible solutions, among which the proposed hybrid microgrid design emerged as the most viable with an NPC of $0.483 million and 99.3% renewable energy utilization. The worst design, which utilized a national grid and diesel generator, resulted in an NPC of $1.89 million with 0% renewable energy integration. The proposed hybrid microgrid design among 932 models established by HOMER Pro software using PV connected to a national grid, and a storage system represents the most optimal solution for RIU Lahore Campus by considering all the necessary factors and requirements.