An experimental method has been carried out in order to perform detailed investigation of electron level populations of multicharged ions in hot dense plasmas produced by lasers. This method provides an accurate diagnostic of the amplification of spontaneous emission (ASE) which may occur in plasma at X-UV wavelengths as a result of population inversions. Results are presented for lithium-like ions of aluminum and magnesium. A strong departure from Boltzmann's population ratio is observed for several of the levels. Population inversion takes place between the 5f and 3d levels, the upper level being approximately three times more populated than the lower one, while the plasma is recombinating. The measured gain coefficient is about 1 cm-1 at 105.7 Å in aluminum for a 20 nanoseconds laser pulse and a 3 GW/cm flux density. Inversions are also observed for 3p-5d transitions. However, the free bound transitions give rise to a spectrum of continuous absorption lowering the net gain, which can be even cancelled in some cases. A numerical model, using stationary as well as time-dependent solutions of rate equations, has been built. It accounts for the main features of experimental results and is very useful for settling the plasma parameters which are appropriate to a fair yield of ASE.