By Martyn Herman

RIO DE JANEIRO (Reuters) - Mark Cavendish rode a wave of British track cycling gold to put himself in contention for the omnium race on Sunday with three disciplines remaining.

Frenchman Thomas Boudat topped the standings after the scratch race, 4km individual time trial and elimination race with Italian Elia Viviani in second spot, two points behind.

Tour de France stage specialist Cavendish produced a scintillating time trial, going second fastest, 11 seconds quicker than at the London world championships when a poor ride in the discipline left his Rio selection hopes in danger.

However, he was cursing himself when he could finish only seventh in the elimination race when looking comfortable.

He will go into Monday in third place, however, with an eight-point deficit to make up in the final three events, the flying lap, the time trial and the points race.

Cavendish, who won four sprint finishes at the Tour de France to take his tally of victories to 30, is bidding to win an Olympic medal for the first time -- having suffered frustration on the track in 2008 and road four years later.

Britain have already won four of the six track golds in Rio.

Olympic champion Lasse Norman Hansen had looked impressive, winning the 60-lap scratch race and setting a new Olympic record in the 4,000m individual pursuit to have maximum points after two events. But he dropped out first in the elimination race and was sixth going into Monday.

World champion Fernando Gaviria, bidding to be the first Colombian to win an Olympic cycling gold medal, had a mixed day.

He suffered in the individual pursuit, getting lapped by the flying Cavendish. But he repaired some of the damage in the elimination race where he survived to the final three.

"You feel the Olympics are different, with the public, the media, the pressure, for sure, it's more complicated," Gaviria told reporters.

"It's a top field here, but now we're in the battle. We have high hopes. Everyone comes here full gas."

World championship runner-up Roger Kluge, fourth in London, was also in contention in fourth place.

The omnium is the ultimate track cycling test with the disciplines requiring sprinting prowess and endurance.

Points are awarded depending on where riders place in each event with the rider with the most points winning gold.

(Editing by Ed Osmond)