  Consider the diagonal action of the special orthogonal group on the direct
sum of a finite number of copies of the standard representation--the underlying
field is assumed to be algebraically closed and of characteristic not equal to
two. We construct a "standard monomial" basis for the ring of polynomial
invariants for this action. We then deduce, by a deformation argument, our main
result that this ring of polynomial invariants is Cohen-Macaulay. We give three
applications of this result:
  (1) the first and second fundamental theorems of invariant theory for the
above action;
  (2) Cohen-Macaulayness of the moduli space of equivalence classes of
semi-stable vector bundles of rank two and degree zero on a smooth projective
curve of genus at least three (for this application, characteristic three is
also excluded);
  (3) a basis in terms of traces for the ring of polynomial invariants for the
diagonal adjoint action of the special linear group SL(2) on a finite number of
copies of its Lie algebra sl(2).
