An off-grid hybrid energy framework on the basis of wind turbines and photovoltaic panels as the primary source of energy and a biogas generator and energy storage unit as a back-up system, was considered for clean energy generation in a rural area in Semnan, Iran. This study was aimed at designing an optimized hybrid renewable framework with minimal costs and CO2 emissions and highest reliability, utilizing comprehensive modeling based on two energy management strategies. The decision-making variables in this work were the type and number of wind turbines, number of storage units, capacity of solar panels, and the capacity of biogas generator. Then variations in turbine model, inflation rate and biofuel prices and their effect on the optimal design of the hybrid framework was investigated in a range of uncertainties (0, 1, and 2.5 %). Additionally, the powerplant emissions penalty cost rate was also considered. Eventually, the optimal hybrid frameworks were economically and environmentally compared with a stand-alone diesel generator. Optimization results confirmed the superiority of the proposed hybrid wind-solar-biomass-battery system in comparison with other investigated systems. The cost of energy for the optimal design including biogas generator (22 kW), photovoltaic panels (30.7 kW), a 10 kW wind turbine, 11 batteries and an inverter (15.1 kW), while considering the inflation rate of 10 % and the uncertainty rate of 0 %, is equal to 0.201 $/kWh. Additionally, the selected optimal design emitted 97 % less CO2 annually, in comparison with the similarly-sized diesel-based energy system.