Dip-coating glass substrates in the alcoholic solution containing peroxopolytungstic acid (PTA) and EO20PO70EO20 (P123) block copolymer template results in uniform transparent mesostructured P123-PTA hybrid films. The scanning electron microscopy images show that P123 columnar micelles are lying in the plane of the film with an inter-columnar separation of ca. 15 nm, being larger than the spacing of 8.42 nm for the mesophase orientated normal to the substrate. UV irradiation in air of the hybrid films causes the redox reaction between PTA and P123 that not only makes the film coloration but also destroys the ordered mesostructure of the film. Prior to calcination, the mesostructured P123-PTA hybrid films are fragile and allow for etching in water and alcohol. Calcination in air at 200 °C of the P123-PTA hybrid films causes the thickness, the refractive index and the spacing of mesophase to change with changing the calcination time. Keeping the calcined films in air results in an increase in the spacing of mesostructure, attributed to water absorption of the film. The low-angle X-ray diffraction analyses reveal that after calcination the long-range ordered mesostructure is preserved in the film on the tin-rich surface of the glass substrate but lost in that on the opposite side (not containing tin) of the substrate. By locally coating the mesostructured PTA-P123 hybrid film onto an integrated optical polarimetric interferometer for sensing ammonia gas based on the acid-base interaction, the detection of 148 ppb ammonia in air at room temperature has been realized.