This research is dedicated to the numerical assessment of the performance of a novel system that uses solar and geothermal energy at the same time, which is capable of heating/cooling the outside air before it enters the air conditioning system of a building and supplying the required electricity for the building. The desired system consists of a photovoltaic/thermal-heat pipe (PVT-heat pipe) unit and an earth-air heat exchanger (EAHE). To cool the outside air in hot seasons of the year, the air is passed through the EAHE system and the exhaust air from building is used to cool the photovoltaic panels. Outside air heating in cold seasons is also possible by passing air through the PVT-heat pipe and EAHE systems. The genetic algorithm-based two-objective optimization is used to determine the necessary conditions to simultaneously maximize the annual useful energy and exergy yields of the hybrid system. The performance metrics of the optimal system are compared with the corresponding values of the PVT-EAHE unit. Outcomes revealed that the annual useful energy output of the PVT-heat pipe-EAHE system (93925.6kWh) is less than the PVT-EAHE system (96448.6kWh), while the PVT-heat pipe-EAHE system is able to produce more exergy (10904.5kWh) than the PVT-EAHE system (10015.5kWh)