The dynamic programming algorithm is used to determine the optimal allocation of effort (measured in dollars or other appropriate units) to minimize the variance on the measurement of Material Unaccounted For (MUF) in a nuclear materials safeguards system. A multistage model of a hypothetical safeguards sampling system is formulated and optimized. The dynamic programming approach for optimization of a safeguards system allows more exact treatment of the model than is possible with classical optimization techniques and can easily be extended to handle large problems of the type that might be encountered in a real-world safeguards sampling system.