I am trying to develop treasure for my players and figure out how much a spellbook is worth based on the level and number of spells held in it. For example, how much is a spellbook that contains one 4th-level spell worth?
From the SRD:
Selling a Spellbook
Captured spellbooks can be sold for a gp amount equal to one-half the cost of purchasing and inscribing the spells within (that is, one-half of 100 gp per page of spells). A spellbook entirely filled with spells (that is, with one hundred pages of spells inscribed in it) is worth 5,000 gp.
So, a spellbook with a single 4th level spell (4 pages) can be sold for 200 gp. Per the general rules on selling treasure, this means that the spellbook is "worth" 400 gp (but can only be sold for half price, like most treasure).
As pointed out by Hey I Can Chan, DMG p. 54 also has some guidelines for how to evaluate the value of an enemy wizard's spellbook when including it in a larger treasure haul, recommending that you:
...subtract the value of a spellbook and material components...from the average treasure value before you start rolling up treasure. Alternatively, you can add up the value of all the components and the spellbook, and compare the value to Table 3-3: Treasure Values per Encounter. Find the value that most closely approaches that total, and subtract it from the level of the encounter. Use that new level to generate the rest of the treasure