I read a book many years ago about a planet where the soil has to be treated by a limited number of machines driven by a higher 'caste' of humans who live in a metal city. The young protagonist has to renounce his preconceptions after challenging the authority of the leading caste. I believe the author may have been female.
This Star Shall Abide by Sylvia Engdahl? 1972.
Colonists on a planet with deadly soil/water that must be treated by technicians. The story takes place a few generations after landing. Limited tech, no off-planet support, and the population kept ignorant of the true situation. Protagonist challenges Authority, is given access to the memories of the colony's leader, learns the truth.
Noren knew that his world was not as it should be— it was wrong that only the Scholars and Technicians could use metal and Machines. It was wrong that only they had access to the knowledge hidden in the mysterious City. He was a heretic. He defied the High Law and had no faith in the Prophecy’s promised fulfillment. But was defiance enough, or could some way be found to make it come true?