thank you very much for sharing your question with the Wefugees Community.
When you fail your Master Thesis, you usually have a maximum of 2 more chances to do your Thesis. You should contact the Academic Advice Office for International students of your university (Studienberating für Internationale Student*innen). They will give you detailed information on this.
You have already posed some questions about marrying someone with a German passport and about the application for asylum in this platform, which are two more possibilities for you to remain in Germany, and my colleagues and I have already answered your questions regardingly.
For further information, you can go the the following links and read some more about it in German:
I hope my answer was useful for you and I'll be very pleased if you contact me again with further questions. I'm a member of the MBEON-staff and I‘ll be glad to guide you over a longer period of time. Mbeon is an online consultancy for migrants via the mbeon-app, which you can install on your smartphone for free. Download it via App Store or Google Play Store. You'll find me In the mbeon-app under my name „München, Herr Noori“ and get confidential one-to-one advice in a safe virtual room where nobody can wiretap messages. Further information: www.mbeon.de.