If I'm playing as a Barbarian or a Valkyrie or something similar, is there anything I can do with spellbooks other than just sell them for a little bit of gold?
Every class, spellcasting oriented or not, has a "specialty spell" which they are extra proficient with. They also have different masteries for each different school of magic. The Nethack Wiki contains detailed information on masteries and such in their individual role pages, and I've included a condensed table of that information at the bottom of this answer. These bonuses primarily affect the success rate of the spells working.
For example, Barbarians actually can reach Skilled in Attack spells. Their specialty spell is haste self, although they cannot advance past Unskilled for Escape spells. Even though you aren't a true spellcaster, your success rate with those spells is enough that you can use them with relative ease. Of course, you probably won't use spells that often as you'll be beating your opponents to pieces, and one should also be mindful not to spend so many masteries on spellcraft and neglect your mightier physical prowess. But outside of spells, there's little else that you would be spending your Pw on.
Of special note are Knights, who are more traditionally physical but their Quest Artifact gives them, and them alone, a lot of power when casting spells. In particular, they deal double damage with the magic missile and cone of cold spells, resulting in even higher damage capability than Wizards.
Of course, without boosting your Intelligence, it is difficult to read the non-blessed books. So until you get smarter, you might consider selling the ones you know you'll never use, but stashing any that you might see yourself casting. Always keep in mind what your specialty spell is, and what masteries you can use. Sometimes, a spell can really shift the tides of battle, even if your blade is better 90% of the time.
Below is a table representing each role, what schools of magic they can reach what level of mastery, and what their specialty spell is. Note how every class other than the Valkyrie can reach Skilled in at least one school of magic, and the Valkyrie still gets a specialty spell in Attack spells.
Learning at least one spell in the early game is useful later on, as a forgotten spell (you'll forget a spell 20,000 turns after you read the book) is a fairly-reliable and free way to confuse yourself. Being confused is often useful as it can change the effects of some scrolls (most notably Gold Detection, which can be used to detect traps and portals when confused).
If you're too dumb to read even a low-level spellbook in the early game, you can always bless one, which makes reading success guaranteed.