In the inertial confinement fusion (ICF) system, the uniformity of the target is important to the successful ignition. A method based on the phase-shifting interferometry and ray tracing is proposed to obtain the 2D (two-dimensional) refractive index distributions of the ice-layer at three wavelengths (532 nm, 785 nm, 1064 nm), from which the 2D density distribution of the ice-layer is got. A differential method is utilized to get the reference refractive index, based on which the refractive index distribution of the layer is retrieved. For targets with uniform refractive index in the ice-layer, simulations show that the relative retrieval accuracies are better than 10 ppb. Experiments show that the refractive index distributions have good consistency at different wavelengths for the same target. The detectable normalized RMS (root mean square) of the refractive index distributions is at least 2.9E-4. The relative accuracies of the average refractive indexes of the shells are better than 1.5% for all three wavelengths. The optimal selection of the two rings on the wavefront map that yields minimal uncertainty to the reference refractive index is discussed. It is concluded that the proposed method and system poses great potential in the in-situ measurement of the refractive index and density distribution of the ICF target layers.