Medium and heavy rare earths (REEs) are mainly from weathered crust elution-deposited rare earth ores (WREOs), where REEs are adsorbed in ionic form on the surface of clay minerals such as kaolinite, illite, halloysite, etc. REEs in WREOs are extracted through the in situ leaching process with (NH4)2SO4 solution via ion exchange. However, this process often results in the swelling of clay minerals, subsequently destroying the ore body structure and causing landslides. This study investigated the inhibitory effects of humic acid (HA) on the swelling of primary clay minerals. An optimal inhibition on the swelling of clay minerals was demonstrated at 0.2 g/L. HA was mixed with 0.1 mol/L (NH4)2SO4 solution at the solution pH of 6.8 and temperature of 25 °C. The swelling efficiency of kaolinite, illite, and halloysite in presence of HA decreased by 0.29%, 1.19%, and 0.19%, respectively, compared to using (NH4)2SO4 alone. The surface hydration parameter of clay minerals was further calculated through viscosity theory. It was demonstrated that the surface hydration parameter of kaolinite and halloysite decreased nearly threefold, while that of illite decreased fivefold, demonstrating a desirable inhibition on clay swelling with HA. Viscosity theory offers valuable theoretical support for the development of anti-swelling agents.