Ghost imaging (GI) is an imaging technique that uses the second-order correlation between two light beams to obtain the image of an object. However, standard GI is affected by optical background noise, which reduces its practical use. We investigated the robustness of an instant ghost imaging (IGI) algorithm against optical background noise and compare it with the conventional GI algorithm. Our results show that IGI is extremely resistant to spatiotemporally varying optical background noise that can change over a large range. When the noise is large in relation to the signal, IGI will still perform well in conditions that prevent the conventional GI algorithm from generating an image because IGI uses signal differences for imaging. Signal differences are intrinsically resistant to common noise modes, so the IGI algorithm is strongly robust against noise. This research is of great significance for the practical application of GI.