An ophthalmic pharmaceutical composition containing an azole compound, a method for preparing the same, as well as a use of the pharmaceutical composition in the preparation of an ophthalmic preparation for preventing and treating ophthalmic diseases. The ophthalmic preparation contains the azole compound at a concentration of 0.005-400 µM.