British Transport Police (BTP) said the “despicable behaviour” happened on the 1.19pm Edinburgh Waverley to Cowdenbeath service on Saturday.
It is understood the group, who left the train in separate groups at Dunfermline Town and Dunfermline Queen Margaret stations, were heading to the Dunfermline v Hearts game at East End Park, which finished 2-0 to Hearts.
Constable Stuart Cowan, the officer in charge of the inquiry, said: “Hate crime of any form will not be tolerated by BTP on Scotland’s rail network. Passengers and rail staff should be able to travel without the threat of encountering antisocial behaviour.
“I am appealing for anyone who was on the train or the stations and witnessed the despicable behaviour of the so-called supporters or has any information regarding the identity of those involved to contact me as a matter of urgency.”
Anyone with information should contact BTP on 0800 405 040 or Crimestoppers in confidence on 0800 555 111.