In this article, considering the factors such as well trajectory and tubing string structures, the transient shut‐in tubing string pressure fluctuation model of ultra‐deep high‐temperature and high‐pressure (hereinafter referred to as HTHP) gas well is established, the propagation of pressure wave along the well depth is obtained, and the effects of different production and shut‐in time on the fluctuating pressure and its variation range are analyzed. Through calculation and analysis, it can be seen that there are differences in pressure waveforms at different well depths. The closer to the bottom of the well, the more delayed the occurrence of water hammer, and the smaller the water hammer pressure value. The larger the production, the greater the pressure wave velocity, and the closer to the wellhead, the more obvious the change. For well X, the pressure wave velocity in the well section below 6500 m varies greatly with the increase of production. When the production is 140 × 104 m3 D−1, the difference of pressure wave velocity between the bottom hole and the wellhead is 105.19 m s−1. After instantaneous shut‐in, the wellhead pressure increases by 3.2% compared with the initial pressure and the bottom hole pressure increases by 0.6%.