In the present context, the global concern on energy consumption and management have been significantly increased due to the environmental issues, such as global warming and greenhouse gas emission. The heating supply is one of the most energy-intensive applications at present, and this study presents an effective model for planning and utilizing a district heating system. Further, the model is applied to a province in Turkey to fulfill environmental, technical, and economic goals. In the first step, indices have been used, including demographics, efficiency of the buildings, and the number of households, to predict the required heating load by support vector regression (SVR) as a supervised machine learning method until 2030. The heat energy demand would be increased by 9% in 2030 compared to 2020. Thereafter, most suitable regions are evaluated to establish district heating systems based on geographic information system (GIS). The classification of Gaziantep province shows that more than 70% of the area is suitable for establishing a solar-based district heating system. The center of the province including Shahinbey, Sehitkamil, and Araban, is the highest priority to integrate a solar energy system into the existing energy system to maximize its share of the energy system. Therefore, in this research, five general scenarios including different combinations of heat pump (HP), solar thermal (ST), photovoltaic (PV) system, battery (BT), and heat storage (HS) are defined and analyzed to determine the most effective scenario, in terms of economic and environmental aspects. Finally, results show all scenarios could reduce the CO2 emissions; however, the combination of ST and HP has the least costs due to the 21.8% reduction in the total primary energy (TPE) supply compared to BAU. Applying solar energy with a heat pump (S5) leads a 37% reduction in CO2 emissions compared to BAU. Overall, the minimum emissions is belonged to scenario 5, including solar heat pump and storage. Moreover, the effects of parameters such as carbon taxes, technological advancements, and electricity prices are evaluated by to sensitivity analysis to confirm the reliability of the results.