A shepherd was someone who tended to and guarded flocks of sheep. The term could also be used to describe someone tending to and guiding a group of people.
When Apollo first greeted the crew of the USS Enterprise, he announced how long he had awaited that moment, and reminisced of "lush and beautiful Earth, the green fields and blue skies, the simple shepherds and their flocks.
Later, when Carolyn Palamas betrayed Apollo and his love, she told him, "Love you? Be logical. I'm not some simple shepherdess you can awe. Why, I could no more love you than I could love a new species of bacteria." (TOS: "Who Mourns for Adonais?")
The main character story of The Boy Who Cried Wolf was a young boy who was a shepherd. He would falsely tell nearby villagers that a wolf was threatening his sheep, but when they arrived to help him he said that it left. After doing this repeatedly the villagers knew he was lying and did nothing when he did tell the truth. He ended up being eaten by the wolf. (DS9: "Improbable Cause")
In 2372, the Ferengi imposed an six percent tariff on woolen goods they traded with the Karemma, claiming that the tax was added to help offset the "lost income of Tarkalean sheep herders." (DS9: "Starship Down")
Kathryn Janeway once compared taking four inefficient officers on an away mission to a shepherd tending to a flock. At the conclusion of the mission, she said "The good shepherd went after some lost sheep...and ran into a wolf." (VOY: "Good Shepherd")