A man has died after a farming accident in eastern Victoria.

Police say the man was trying to put the cow in a race at a dairy farm at Inverloch on the Bass Highway on Tuesday afternoon when the animal headbutted him in the chest and crushed him against a steel gate.

The man, aged in his fifties, walked away but collapsed a few minutes later.

He was flown to Royal Melbourne Hospital where he died last night.

Police will prepare a report for the coroner.