There is no specific built-in support for something like this, but that doesn't mean it cannot be done.
If your metric has a symbolic D dimension, then xCoba will not be able to handle that. You need to do your computation in xTensor.
Imagine you want to work in D-dimensional spherical symmetry. The first steps would be something like this:
<< xAct`xTensor`
Define the symbolic dimension:
DefConstantSymbol[dim, PrintAs -> "D"]
Define the radial manifold:
DefManifold[M2, 2, {a, b, c, d}]
Define the D-dimensional spheres:
DefManifold[MD, dim, {A, B, C, D}] // Quiet
Define the product manifold of those two manifolds:
DefManifold[M, {M2, MD}, {\[Mu], \[Nu], \[Lambda], \[Sigma]}]
Now define the metrics of each manifold:
DefMetric[-1, g[-a, -b], cd]
DefMetric[1, G[-A, -B], CD]
And now you would use DefProductMetric to construct the metric (diagonal by blocks) of the product manifold. See section 7.6 of xTensorDoc.nb on how to work with product metrics. Here is a link to an old HTML dump of that section:
Then you would construct your Lagrangian from the object defined in those manifolds, and then I guess you would use VarD to compute the equations of motion.
Jose.