In laparoscopic surgery, the smoke generated by operations including electrocautery and laser ablation seriously degrades the quality of endoscopic images. It not only reduces the visibility of the surgery, leading to increased risk of surgery, but also affects the performance of image processing in computer‐assisted surgery such as segmentation, 3D reconstruction and tracking. Therefore, a desmoking algorithm is required to eliminate smoke in endoscopic images. In this article, we study a U‐Net model that can eliminate smoke of the laparoscopic image in real‐time and preserve the natural appearance of the organ surface. Our method is based on the improved U‐Net in which convolutional block attention module is used as an embedded guide mask of the decoder part. The laparoscopic image dataset is provided by the Hamlyn Center, and the Blender software is used to simulate various situations of smoke added to the laparoscopic image for training and testing. For the proposed method, the peak signal‐to‐noise ratio value is up to 29.27 and the structural similarity index is up to 0.945 over the test images. The experimental results demonstrate that the proposed method achieves a better performance than other six existing methods, which is applicable for real‐time endoscopic image processing.