A herbivore is a creature that (when tamed) prefers to eat vegetable matter such as fruit, vegetables, fungi, and other plants. Apples and carrots are considered treats. They will eat safe vegan corpses such as lichens, mold, shriekers, blobs, and jellies if they find them lying on the ground. They will also eat melons, oranges, pears, wolfsbane, garlic, kelp fronds, and so on, but only when hungry. If they are very hungry, they will eat some people food like food rations, pancakes, and lembas. They will never eat meat products, meaty corpses, eggs, or tins.
When a herbivorous pet is used as a steed, it won't eat vegetables other than apples and carrots while you ride it, even if hungry. It will only do so when starving (which divide maximum hit points by 3). So if you don't have any apples and carrot and can't heal your pet, you might want to dismount it to feed it some fruits when it's hungry. For non-knight players, this will keep tameness unchanged (+1 for feeding and -1 for remounting it).