With the wide application of thermoelastic structures in industries such as the aerospace field, the problem of topology optimization of thermoelastic structures has become a very common and important research topic. It is well known that the thermal environment has a non‐negligible influence on the dynamic performance of structures. However, few people consider the influence of the thermal environment on structural stiffness in thermoelastic dynamic topology optimization. In practical engineering applications, the influence of the environment on the structure performance should be considered to obtain the optimal structure. In this paper, we focus on the problem of dynamic topology optimization considering the effect of non‐uniform temperature fields on structural stiffness. The influence of non‐uniform temperature fields adds on structural stiffness to the topology optimization of thermoelastic dynamic for the first time, thereby comprehensively addressing its effects on structural stiffness in the context of dynamic topology optimization under harmonic vibration and transient load. The proposed method begins by computing the distribution of the non‐uniform temperature field within the structure. Subsequently, thermal stresses in the structure are determined through the application of thermoelastic theory. The geometric stiffness matrix of the structure is then calculated using finite element theory. The dynamic topology optimization model, employing a variable density approach, is established in conjunction with the dynamic compliance design objective. Sensitivity analysis is conducted through the adjoint method, and the design variables are updated utilizing the method of moving asymptotes. Numerical examples are presented to validate the efficacy of the proposed method and obtain the influence of different factors on the optimization results. The results show that the dynamic compliance of the optimized structure increases with increasing heat flux. For the optimization under harmonic vibration, the optimization results obtained by different external excitation frequencies are significantly different. For transient optimization, the study discovers that the optimization present transient effect.