It has been suggested that the Yang-Mills ( YM ) field can be a kind of candidate for the inflationary field at high energy scales or the dark energy at very low energy scales , which can naturally give the equation of state -1 < \omega < 0 or \omega < -1 . We discuss the zero order and first order Einstein equations and YM field kinetic energy equations of the free YM field models . From the zero order equations , we find that \omega + 1 \propto a ^ { -2 } , from which it follows that the equation of state of YM field always goes to -1 , independent of the initial conditions . By solving the first order Einstein equations and YM field equations , we find that in the YM field inflationary models , the scale-invariant primordial perturbation power spectrum can not be generated . Therefore , only this kind of YM field is not enough to account for inflationary sources . However , as a kind of candidate of dark energy , the YM field has the ‘ sound speed ’ c _ { s } ^ { 2 } = -1 / 3 < 0 , which makes the perturbation \phi have a damping behavior at the large scale . This provides a way to distinguish the YM field dark energy models from other kinds of models .