In the source novel, Harry was deeply concerned that his best friend wouldn't make the cut. He'd already tried to clear the stadium so that he'd be under less pressure. When it came down to it, however, Ron simply saved more goals, making him the obvious choice.
‘No,’ said Harry. ‘You’ve had your go. You saved four. Ron saved five.
Ron’s Keeper, he won it fair and square. Get out of my way.’
Harry apparently didn't realise that McLaggen had been hexed until later, by which time it was too late to do anything about it which, after McLaggen's tantrum, he wasn't inclined to do anyway.
‘I was better than that McLaggen anyway,’ said Ron in a highly
satisfied voice. ‘Did you see him lumbering off in the wrong direction
on his fifth? Looked like he’d been Confunded …’
To Harry’s surprise, Hermione turned a very deep shade of pink at
these words. Ron noticed nothing; he was too busy describing each of
his other penalties in loving detail.
In the film, Harry's conduct was far more inappropriate. He was aware of Hermione's behaviour but chose to turn a blind eye to it simply because liked Ron better and was rooting for him to be chosen.
Hermione, face buried in her fingers, MUTTERS SOMETHING.
Cormac, at the last moment, inexplicably rolls his broom
to the right and the Quaffle sails over his shoulder.
Ron, zig-zagging crazily, nearly falls off, rights
himself in a panic, and deflects Ginny’s Quaffle... with
his forehead. As a few partisan CHEERS erupt from the
stands, Harry grins, then has to restrain himself.
Hermione opens her eyes slowly.
HARRY: Yeah. I suppose I could’ve just used, I dunno... a Confundus charm?
HERMIONE: (caught) That was different. It was tryouts. This was an actual match --
Half Blood Prince - Screenplay