This work aims to create a machine-learning model that can contribute to a comprehensive understanding of Egypt's terrestrial heat flow distribution. The model is based on the random forest regression method, with a sparsely distributed dataset of heat flow measurements. The model is trained using 16 geophysical and geological databases, which are well-known for their efficacy in geothermal evaluation. These databases provide a robust foundation for the model, ensuring its accuracy in predicting the terrestrial heat flow in Egypt. The results confirm that the Red Sea rift region exhibits the highest terrestrial heat flow values, ranging from 100 to 185 mW/m2. In contrast, the Mediterranean offshore zone shows values varying from 40 mW/m2 in the eastern sector to 110 mW/m2 in the west. The southern part of the Sinai Peninsula and the two Gulfs display heat flow values between 60 and 90 mW/m2, while northern Sinai has lower values between 40 and 50 mW/m2. The central region of the Eastern Desert presents heat flow values of 60 to 80 mW/m2, with northern and southern areas showing 50 mW/m2. The Nile Delta records a heat flow of 50 mW/m2, peaking at 60 mW/m2. The Western Desert reveals three distinct heat flow zones relevant to its geological structure: 60 mW/m2 in the unstable shelf to the north, 50 to 80 mW/m2 in the stable shelf at the center, and the Arabo-Nubian Massif in the south, which has the lowest terrestrial heat flow in Egypt, ranging from 30 to 60 mW/m2. This study's findings underscore Egypt's complex geothermal nature, highlighting significant and intriguing variations in terrestrial heat flow influenced by tectonic activity and geological structures. The Red Sea rift region is a hotspot for geothermal potential, which could be harnessed for sustainable energy production.