The invention provides a restoring-type near infrared fluorescence probe with pH response. The chemical structural formula is shown as a formula (I) in the specification, wherein X refers to C(CH3)2, O, S or Se, Y refers to halogen, Z refers to NH, O or S, R1 and R2 are respectively independently selected from H, C1-18 alkyl or SO3R5, R5 refers to C1-18 alkyl or benzyl, and R3 and R4 are respectively independently selected from C1-18 alkyl or benzyl. When the restoring-type near infrared fluorescence probe with pH response is between pH 5.0 and pH 7.5, the fluorescence intensity is gradually enhanced along with reduction of the pH value, and an excellent linear relation is formed between the fluorescence intensity and the pH value. The stocks displacement is large, the signal to noise ratio is low, the toxicity is low, the damage to cells and living bodies is small, the pKa is 6.4, the probe is very suitable for tumor detection, and the defects of fluorescence probes in the prior art are overcome. The invention also provides a method for preparing the probe. The preparation method is simple.