Jamie Rhodie and his group also sang vile religious abuse and chanted sick taunts about Celtic legends Danny McGrain and Tommy Burns.
Dundee Sheriff Court heard that the group, who were travelling from Glasgow to Rangers' SPL match with Dundee United last September, approached Hamilton-based sheriff Harry Small, who was travelling with his young son.
They screamed at him after noticing him wearing a green fleece jumper.
Rhodie was given a one-year banning order, but only after the sheriff dealing with the case checked if it would apply to Rangers' Division Three matches.
Fiscal depute Vicky Bell told the court that Rhodie was in a group of eight to 10 Rangers fans travelling on the 9.41am Dundee train.
She said: "A witness, who is a serving sheriff in Scotland, boarded the train at Glasgow with his son.
"About 20 minutes into the journey the Rangers fans started singing sectarian songs, and continued all the way to Dundee – a journey of one hour 20 minutes.
"On December 3, police at the SPL match at Ibrox between Dunfermline and Rangers noticed the accused and took his details."
Rhodie, 19, of Gartcosh, North Lanarkshire, pleaded guilty to carrying out a religiously aggravated breach of the peace.