Cosmological models with an SU(2) Yang-Mills field are studied. For a specific model with a minimally coupled Yang-Mills Lagrangian, which includes an arbitrary function of the second-order term and a fourth-order term, a corresponding reconstruction program is proposed. It is shown that the model with minimal coupling has no de Sitter solutions, for any nontrivial function of the second-order term. To get de Sitter solutions, a gravitational model with nonminimally coupled Yang-Mills fields is then investigated. It is shown that the model with non-minimal coupling has in fact a de Sitter solution, even in absence of the cosmological constant term. © 2013 Pleiades Publishing, Ltd.