By Mark Trevelyan

RIO DE JANEIRO (Reuters) - Australian Mack Horton won the men's Olympic 400 meters freestyle on Saturday, edging out defending champion Sun Yang of China as Australia set out to erase the memory of their disappointing swimming performance in London four years ago.

Gabriele Detti of Italy took bronze.

Horton, 20, was content to shadow Britain's James Guy and Conor Dwyer of the United States for much of the race but forged ahead after 300 meters, made the final turn in the lead and held off Sun in the last 50 meters.

The 20-year-old is taking part in his first Olympics and will also compete in the 1,500 freestyle and 4x200 relay.

"It hasn't really sunk in yet. I have a couple more races this week so I need to relax a little bit and focus on those, but it's very exciting," he told reporters.

It was a dream start for Australia, a traditional swimming power who faltered badly in London, winning just one gold medal in the women's 4x100 freestyle relay.

Dwyer, fastest in the morning heats, came fourth, with American Connor Jaeger fifth and Guy, the world silver medalist last year, fading to sixth.

London champion Sun was in tears after the race.

"Based on my ability, I should have been the champion, I trained very hard," he told reporters.

Sun won two golds at London 2012 and was the first Chinese male swimmer to win an Olympic title.

He has had problems out of the pool since London, serving a three-month ban in 2014 after testing positive for a banned stimulant and spending a week in jail for crashing a car while driving without a license.

(Additional reporting by Brenda Goh)