In IRS Publication 538 Accounting Periods and Methods, there is a section regarding Inventory starting on page 13. Page 15 is regarding the valuing of inventory:
The value of your inventory is a major factor in figuring your taxable income. The method you use to value the inventory is very important.
The following methods, described below, are those generally available for valuing inventory.
Goods that cannot be sold. These are goods you cannot sell at normal prices or they are unusable in the usual way because of damage, imperfections, shop wear, changes of style, odd or broken lots, or other similar causes. You should value these goods at their bona fide selling price minus direct cost of disposition, no matter which method you use to value the rest of your inventory. If these goods consist of raw materials or partly finished goods held for use or consumption, you must value them on a reasonable basis, considering their usability and condition. Do not value them for less than scrap value. For more information, see Regulations section 1.471-2(c).