We study the periodic orbits of a generalized Yang-Mills Hamiltonian H depending on a parameter β. Playing with the parameter β we are considering extensions of the Contopoulos and of the Yang-Mills Hamiltonians in a 3-dimensional space. This Hamiltonian consists of a 3-dimensional isotropic harmonic oscillator plus a homogeneous potential of fourth degree having an axial symmetry, which implies that the third component N of the angular momentum is constant. We prove that in each invariant space H = h > 0 the Hamiltonian system has at least four periodic solutions if either β 6 and β != 5 sqrt(13). We also study the linear stability or instability of these periodic solutions