In order to study the effect of temperature on the structure and mechanical properties of coal with different metamorphic degree. Three coal samples with varying degrees of metamorphism were chosen for analysis. The discrete element software PFC2D is used to simulate the heat treatment and compression of coal. The findings indicate that during the heating process, low-order coal exhibits noticeable thermal cracks at an early stage, while thermal crack development in middle-order coal is concentrated in the later stages. In contrast, high-order coal demonstrates a more stable macroscopic structure. The strength and stiffness of low rank coal show the lowest value and decrease significantly within 135 °C. However, the strength and stiffness of medium rank coal decrease significantly after 135 °C. The changes of mechanical properties and damage modes of coal caused by thermal damage are often ignored, which may lead to the deviation of design and research results from the actual situation. Therefore, this study is of great significance to the prevention and control of coal mine disasters.