Back the wrong horse

To support someone or something that cannot win or succeed.

We backed the wrong horse in the election and our candidate lost badly.