Although measuring the gas metallicity in galaxies at various redshifts is crucial to constrain galaxy evolutionary scenarios , only rest-frame optical emission lines have been generally used to measure the metallicity . This has prevented us to accurately measure the metallicity of dust-obscured galaxies , and accordingly to understand the chemical evolution of dusty populations , such as ultraluminous infrared galaxies . Here we propose diagnostics of the gas metallicity based on infrared fine structure emission lines , which are nearly unaffected by dust extinction even the most obscured systems . Specifically , we focus on fine-structure lines arising mostly from H ii regions , not in photo-dissociation regions , to minimize the dependence and uncertainties of the metallicity diagnostics from various physical parameters . Based on photoionization models , we show that the emission-line flux ratio of ( [ O iii ] 51.80+ [ O iii ] 88.33 ) / [ N iii ] 57.21 is an excellent tracer of the gas metallicity . The individual line ratios [ O iii ] 51.80/ [ N iii ] 57.21 or [ O iii ] 88.33/ [ N iii ] 57.21 can also be used as diagnostics of the metallicity , but they suffer a stronger dependence on the gas density . The line ratios [ O iii ] 88.33/ [ O iii ] 51.80 and [ N ii ] 121.7/ [ N iii ] 57.21 can be used to measure and , therefore , account for the dependences on the of the gas density and ionization parameter , respectively . We show that these diagnostic fine-structure lines are detectable with Herschel in luminous infrared galaxies out z \sim 0.4 . Metallicity measurements with these fine-structure lines will be feasible at relatively high redshift ( z \sim 1 or more ) with SPICA , the future infrared space observatory .