In this paper, a relative error calibration unit has been designed to analyze and calibrate the common relative errors in optical fiber gas detection system based on directly absorption spectrum (DAS) technology. The ammonia gas was successfully encapsulated in one cut of hollow core fiber as the closed micro-cavity reference cell by dipping saturated solution and cascade-fusing fibers. Through the difference algorithm, the maximum relative error caused by the power fluctuation of the light source is reduced by 85.3 %; to reduce the temperature drift effect caused by optical fiber structure and ammonia absorbance, the calibration equation is obtained by fitting and inversion calculation. The temperature relative error decreases by 95 %. The proposed self-referencing hollow fiber gas sensing probe has a compact structure and can be used for precise monitoring of harmful gases in harsh environments such as narrow space, strong electromagnetic interference, high temperature and humidity.