In the process of underground gasification of coal, the top rock of coal seam will experience a certain high temperature action and be in a complex stress environment. Therefore, it is of great theoretical and engineering significance to study the effect of cyclic unloading and loading on mechanical properties of rocks under high temperature action. In this thesis, the stress–strain curves of sandstone under different high-temperature treatments are obtained by conducting graded loading and unloading tests on sandstone treated at room temperature and at 200 °C, 400 °C, 600 °C, and 800 °C, respectively. The research content of this paper is as follows: the peak stress, peak strain, elastic modulus, Poisson’s ratio, internal friction angle, and cohesion of sandstone in the destruction stage of sandstone. The results show that the peak strain and cohesion of sandstone show an increasing trend with the increase of temperature from room temperature to 800 °C; the peak stress shows a decreasing trend with the increase of temperature from room temperature to 800 °C; the modulus of elasticity tends to increase from 200 °C to 400 °C and to decrease with temperature in the rest of the period; the Poisson’s ratio tends to increase from 600 °C to 800 °C and to decrease with temperature in the rest of the period; the internal friction angle increases sharply within room temperature to 200 °C, decreases slowly within 200–600 °C, and decreases sharply when the temperature exceeds 600 °C. The results of the study will provide important reference significance for the design and engineering application of the gasifier of a coal-bed underground gasification project.