The invention relates to a stable composition for ophthalmic dying, suitable for sterilization in an autoclave, comprising the following in an aqueous solution: - at least a dye, - at least a water-soluble polyol with formula H(HCOH)nH, where n is a whole number greater than 3, for use in either of the two following methods: an ophthalmic surgical treatment method and a diagnosis method.