With the version of Cadabra currently on github (2.3.1.5) you can write a small function which examines every term in the expression, counts the number of '5' indices, and flips the sign if there is an odd number of pairs. Starting from
{m,n,p}::Indices(space);
{\mu,\nu}::Indices(subspace, parent=space);
ex:=A^{m n} B_{m n};
split_index(ex, $m, \mu, 5$, repeat=True);
which produces AμνBμν+Aμ5Bμ5+A5μB5μ+A55B55, you can define
def flip5(ex):
for node in ex:
for term in node.terms():
cnt=0
for index in term.indices():
if index.name=="1" and index.multiplier==5:
cnt+=1
term.multiplier *= (-1)**(cnt//2)
return ex
and then do
flip5(ex);
to get AμνBμν−Aμ5Bμ5−A5μB5μ+A55B55