The niobium metal–organic framework (Nb‐MOF = [Nb2(bdc)2(NDI)]n) membrane, constructed from terephthalic acid(bdc) and 1,8,4,5‐naphthalenetetracarboxdiimide (NDI), is in this work grown on the surface of lithium niobate (LiNbO3) film composite optical waveguide (COWG) substrate using UV‐light illumination method. After growing for 20 min, the Nb‐MOF membrane forms as a graphene‐like structure with 50 nm pore size and 96 nm thickness. At room temperature (25 °C), in terms of COWG sensors, Nb‐MOF exhibits the greatest response to H2S and SO2, followed by ethylenediamine (EDA) and NO2, coexistence with 15 kinds of benzenes, amines, and acidic gases. In order to improve its response selectivity, the spirooxazine (SP) is embedded into the Nb‐MOF frame, and a SP@Nb‐MOF membrane COWG with smooth‐snowflake imprinted surface is obtained. In gas sensing performance, the obtained COWG shows the greatest response to H2S, while the response of SO2, NO2, and other gases are obviously diminished. When the SP@Nb‐MOF membrane exposes to H2S gas, proton‐transfer and morphology modulation are induced. The presented sensor also shows a wide detection range (1 × 104–0.1 ppb), fast response (4 s), and long‐term stability of 120 d to H2S at room temperature (25 °C) and 25% relative humidity.