  We define a conformally invariant action S on gauge connections on a closed
pseudo-Riemannian manifold M of dimension 6. At leading order this is quadratic
in the gauge connection. The Euler-Lagrange equations of S, with respect to
variation of the gauge connection, provide a higher-order conformally invariant
analogue of the (source-free) Yang-Mills equations.
  For any gauge connection A on M, we define S(A) by first defining a
Lagrangian density associated to A. This is not conformally invariant but has a
conformal transformation analogous to a Q-curvature. Integrating this density
provides the conformally invariant action.
  In the special case that we apply S to the conformal Cartan-tractor
connection, the functional gradient recovers the natural conformal curvature
invariant called the Fefferman-Graham obstruction tensor. So in this case the
Euler-Lagrange equations are exactly the "obstruction-flat" condition for
6-manifolds. This extends known results for 4-dimensional pseudo-Riemannian
manifolds where the Bach tensor is recovered in the Yang-Mills equations of the
Cartan-tractor connection.
