Diesel generators (diesel gensets) are widely used within microgrid (MG) and off-grid systems for rural electrification, particularly in developing countries. The sizing and selection techniques during the MG planning stage are a key for maximising cost-effectiveness and minimising environmental impacts. This becomes more important for hybrid mini-grid systems when photovoltaic (PV) electricity generation and other renewable energies are included in the system as special attention is needed to limit the genset’s output power, to keep it within the recommended operating range. This paper presents a cost optimisation model, centred on the generatoŕs performance, within diesel/PV/battery MGs, for minimising the MG’s operating costs and environmental impact. The model considers fuel consumption equations adapted for castor oil-diesel (COD) blends and two major pollutant emissions (NOx and PM2.5), which are not considered in other optimisation models. The optimisation was implemented for high, medium, and low electricity demand scenarios, with eight possible system configurations, for the Lindi Region of Tanzania as it belongs to one of the five countries with the lowest electricity access in sub-Saharan Africa (SSA). An economic assessment was done to compare the Levelized Cost of Energy (LCOE) of the system configurations. The impact of the fuel price and pollutant emission costs on the fuel selection was investigated using sensitivity analysis. The results confirmed that for specific electricity demand each scenario requires a unique set of diesel generators and the selection is affected by the PV share and the battery energy storage (BES) units included. The best LCOE for the high, medium, and low electricity demand scenarios were 0.43£/kWh, 0.42£/kWh, and 0.45£/kWh, respectively. The sensitivity analysis revealed that the pollutant emission costs have a significant impact on LCOE for the different fuel choices whereas the variation of fuel prices has a minimal effect unless the diesel price increased by 100%.