Police have charged a 22-year-old man with the stabbing death of an elderly man at a mosque in Dallas in Melbourne's north-western suburbs.

Erol Elmas, from Broadmeadows, faced an out-of-sessions court hearing on Thursday night at the St Kilda Road police centre.

He was charged with one count of murder.

A Glenroy man aged in his 70s was fatally stabbed when he and two other men tried to stop Mr Elmas from entering the Turkish Islamic and Cultural Centre shortly before 11am on Thursday, police allege.