"On a farm" is correct for all verbs. You'd never say "in a farm" in English, whether you were trying to say you lived there, worked there, repaired some equipment there... it's always "on a farm" (or "on the farm" for a specific farm).
It's quite irregular and there's no easy rule to remember, you just have to learn them individually: