I've heard some people say that you can't lose it at all, because if you do really bad it'll just give you a random omniboost or something, so I was just wondering: is it programmed so that you always win or can you lose an have to redo the battle?
It is impossible. Koraidon will live all hits with 1HP due to friendship, and the game will pester you to terastalise and use tera blast before eventually just forcing you to do it.
Source