In deep water drilling, the existence of boost line makes the wellbore temperature change violently, and the thermal stress caused by it has a great influence on the strength of the riser. The paper considers the variable mass flow caused by the boost line fluid entering the wellbore during deepwater drilling. Based on the principle of conservation of mass and energy, the paper establishes a mathematical model for transient heat transfer in different regions of the wellbore and formation, analyzes the effect of the displacement of boost line on the temperature field of the wellbore, and calculates the transient stress of the casing under thermal effect. The results show that with the increase of cycle time, the temperature of the inner wall of the riser above the critical well depth first decreases and then increases. The thermal stress of the inner wall of the riser first increases and then decreases to zero, and then gradually increases, and the final thermal stress remains unchanged. With the increase of cycle time, the thermal stress of the inner wall of the riser increases with the increase of the circulating temperature of the inner wall of the riser below the critical well depth, and the rate of increase decreases gradually, and the final thermal stress remains unchanged. As the displacement of the riser increases, the circulating temperature of the inner wall of the riser increases, and the thermal stress on the inner wall of the riser increases. The research results can provide reference for the analysis of the factors affecting the riser stress in deep water drilling.