The error of humidity sensor induced by solar radiation seriously affects the accuracy of the relative humidity measurement. To solve this problem, this paper presents a novel numerical analysis method of correcting the error of relative humidity based on computational fluid dynamics. In view of the external thermal environmental conditions of radiosonde humidity sensors, the convection-solar radiation coupled thermal boundary conditions are adopted in the numerical simulation with analysis method of fluid-solid coupled heat transfer. The temperature error analysis model is first established from the ground to 32 km altitude with different pressures and temperatures. Combined with Goff-Gratch approximation formulas of saturation vapor pressure, the corresponding fluid dynamic numerical analysis model of relative humidity is put forward for error correction. Moreover, the relative humidity errors are reported in the different physical parameters such as the direction of the solar radiation, the reflectivity of sensor, thermal conductivity of the substrate material, the size of sensor, etc. The data analysis shows that the error of relative humidity, caused by solar radiation nonlinearly increases with altitude. The humidity measurement accuracy is affected notably by the direction of solar radiation. Among the errors caused by solar radiation, the error in the direction perpendicular to the front of the sensor is biggest, the error in the direction of the top of the sensor is the next, and the error in the direction of the side of the sensor is smallest. The data analysis also indicates that the solar heating error of the relative humidity can be reduced by reducing the size of the sensor, reducing the thermal conductivity of the substrate material, or improving the reflectivity of sensor. However, the solar heating error can not be neglected under low air pressure at high altitude. A comparison with experimental results shows that the numerical analysis method of the relative humidity error based on fluid dynamics simulation provides a new way to enhance the radiation error correction.