Answered by Shaykh Yūsuf Badāt
My parents saved some money for me for my education and it has earned interest (ribā). How can I get rid of this ribā money?
Jazāk Allāh Khayr/ Thank you for your question.
If usury and or interest is accumulated, then it will be disposed of by giving it to the poor in charity, without any intention or hope of reward.
There is a report that indicates Abū Bakr (may Allāh be pleased with him) made a two way bet, prior to the prohibition of gambling with a disbeliever. The wealth resulting from wining this bet was given to Abū Bakr (may Allāh be pleased with him) after the prohibition of gambling. Thus, he brought it in the presence of the Prophet (peace and blessings upon him) who instructed, “This is prohibited. Give it in charity (sadaqah)” (Ibn Asākir)
You are not to donate such money towards the construction of a masjid, as only clean and pure money is used to build a mosque. A mosque is also a public facility utilized by both the rich and the poor.
And Allāh Knows Best