The mob attacked the train at the Weddel station late on Sunday evening, breaking windows with stones before throwing smoke bombs inside, police said.
Fans of the football team Hannover 96 were inside the train, returning from a match of the side's amateur players in Potsdam.
Authorities believe the attackers may have been fans of rival team Eintracht Braunschweig who are known for violent behaviour, a police spokesman said.
Security forces travelling with the fans were able to prevent a direct confrontation between the two groups and no one was injured, they said.
Just last week the German police union demanded that Germany's football leagues pay up to €50 million a season to combat hooliganism. The request came after 29 police were injured in a football altercation between Hansa Rostock and St Pauli fans in Rostock.
The union has also recently appealed to a federal court to allow violent football fans to be banned from stadiums even if they don't have a criminal conviction.