Atmospheric stellar occultation observation technology is an advanced space-based detection technology that can measure the vertical distribution of trace gas composition, temperature, and aerosol content in a planet’s atmosphere. In this study, an inversion algorithm of the onion-peeling method was constructed to invert the transmittance obtained from the forward mask. The method used a three-dimensional ray-tracing simulation to obtain the transmission path of the light in the Earth’s atmosphere. The relevant parameters were then combined in the high-resolution transmission molecular absorption (HITRAN) database, and line-by-line integration was performed to calculate the atmospheric transmittance. The transmittance value was then used as an input to calculate the vertical distribution of oxygen molecules when using the single-wavelength inversion of the onion-peeling method. Finally, the oxygen molecule content was compared with the value attained by the Mass Spectrometer and Incoherent Scatter Radar Extended (MSISE00) atmospheric model to determine the relative error of our model. The maximum error was found to be 0.3%, which is low enough to verify the reliability of our algorithm. Using Global-scale Observations of the Limb and Disk (GOLD) measured data to invert the oxygen number density, we calculated its relative deviation from the published result to further verify the algorithm. The inversion result was affected by factors such as prior data, the absorption spectral line type, the ellipticity of the Earth, and the accuracy of the orbit. Analysis of these error-influencing factors showed that the seasons and the Earth’s ellipticity affected the accuracy of the model only 0.001% and could therefore be ignored. However, latitude and solar activity had a greater impact on accuracy, on the order of 0.1%. The absorption line type affected the accuracy of the model by as much as 1%. All three of these factors therefore need to be considered during the inversion process.