A scheme to measure temperature distribution inside a gain medium of a diode-pumped solid-state laser is proposed based on the fluorescence intensity ratio technique. By recording the temperature-dependent upconversion fluorescence related to the H2→I4 and S4→I4 transitions of Er, the real-time temperature distribution inside an Er:Yb:LuAl(BO) crystal end-pumped by a 976 nm diode laser can be measured while a 1.55 μm laser is operating. Influences of pump power, output power, and output mirror transmissivity on the temperature distribution inside the gain medium are investigated. This scheme can conveniently and accurately measure the temperature distribution along the laser path in a rare-earth-doped gain medium in real time.