Dirt without moisture (water content) is NOT a very good conductor and NOT a good ground. So you are right, dirt is not a very good conductor, by itself, and therefor by itself not a good ground. Dry sand & rock are poor grounds too.
Frozen earth isn't a good ground either which is why it is necessary to use grounding stakes long enough to reach below the "frost line". Ice is not a good conductor. In fact ice is approximately an insulator
In fact PURE liquid water is not a conductor at all. It's the mineral contaminates in water that conduct electricity, or rather the ions in those minerals. Salt water has lots of free moving ions, so salt water is very conductive.
Weirder still, pure dry salt doesn't conduct electricity either.
It's all about FREE MOVING ELECTRONS in a conductor and in a solution FREE MOVING IONS.
In pure water there are no free electrons and no ions.
In pure salt there are ions but Sodium Na+ and Cloride CL- ions can't move, ionically bonded to each other.
The polarity of water molecules enables water to dissolve many ionically bonded substances. So liquid salt water contains free moving Na+ and CL- ions. Any other ionic mineral dissolved in water would probably make a good conductor too, in general.
If you freeze that salty water, two things happen. First ice (solid water molecules) tend to exclude the ions Na+ and CL- from the ice crystals. Second, even if the ions are not excluded they can not move enough anymore to transfer charge. Therefore no current.
So grounding into the earth only works well when the soil is right. Often that is moist soil creating a water solution containing free moving ions.
Read this article: "Achieving an Acceptable Ground in Poor Soil"
It talks about how in Hawaii the volcanic soil is a problem for creating a grounding system.