This study selects Beijing from 1980 to 2020 as the research area, utilizing high temporal resolution land use data to analyze through the habitat quality module of the InVEST model. Unlike previous research, this study employs the Theil-Sen Median method and Mann-Kendall test to analyze the trend changes in habitat quality more accurately. This method has significant advantages in dealing with non-linear and non-normally distributed data over long time series, providing a more accurate and reliable analysis of habitat quality trends. Methodologically, the study first collects and organizes the land use type data of Beijing from 1980 to 2020, then uses the habitat quality module of the InVEST model to process and analyze the data of each year, assessing the impact of different land use types on habitat quality. Subsequently, the Theil-Sen Median method and Mann-Kendall test are used to analyze the time series trend of habitat quality, to identify and quantify the trend and significance of habitat quality changes. The results show that over the past 40 years, the area of construction land in Beijing has significantly expanded, leading to a compression of other types of land. The spatial distribution of habitat quality shows a clear difference between the two sides divided by a line connecting the northeast and southwest, with the west side being the area of good habitat quality and the east side being poorer. In the past 10 years, the overall habitat quality has improved, but most areas still show a decreasing trend, especially in the western and northern mountainous areas where habitat quality has significantly declined. Based on these findings, it is recommended that future urban planning and land management should pay more attention to the protection and improvement of habitat quality, especially the restoration work for areas with poor habitat quality.