In this paper, a temperature self-compensated refractive index sensor based on fiber Bragg grating (FBG) and the ellipsoid structure is demonstrated. The ellipsoid can excite the cladding modes and recouple them into the fiber core. Two well-defined wavelength bands are observed in the reflection spectrum of the proposed sensor, i.e., the Bragg resonant peak and the cladding resonant peaks. By measuring the wavelength shift of the cladding resonant peak, the surrounding refractive index (SRI) can be determined, and the wavelength shift of the Bragg resonant peak can be used as a reliable reference to self-compensate the temperature variation (temperature sensitivity of 10.76 pm/°C). When the SRI changes from 1.3352 to 1.3722, the cladding resonant peak redshifts linearly with an average sensitivity of 352.6 pm/RIU (refractive index unit). When the SRI changes from 1.3722 to 1.4426, an exponential redshift is observed with a maximum sensitivity of 4182.2 pm/RIU. Especially, the sensing performance is not very reliant on the distance between the FBG and the ellipsoid, greatly improving the ease of the fabrication.