The 21-year-old from the northern city of Hildesheim had announced his attack plans “in an anonymous internet chat”, the state prosecutor's office in the town of Celle said.
Initial investigations show the suspect “has for some time been considering the idea of committing an attack in which he wanted to kill numerous people in order to attract worldwide media attention,” prosecutors said.
The suspect referenced the attacker who killed 51 people in two mosques in Christchurch in March 2019, and said he wanted to carry out a similar attack.
“His aim was to kill Muslims,” prosecutors said.
Police found weapons in the suspect's home, as well as electronic files containing right-wing extremist content.
He was detained on Saturday and faces charges of threatening to commit criminal offences and financing terrorism through the purchase of weapons.
Germany has been rocked by a string of extreme-right attacks over the past 12 months.
A gunman with apparent far-right beliefs killed nine people at a shisha bar and a cafe in the city of Hanau, near Frankfurt, in February, while two people were killed in an attack targeting a synagogue in Halle, near Leipzig, in October.
In June 2019, pro-immigration politician Walter Lübcke was found shot dead at his home in the central state of Hesse, and a far-right sympathiser has been charged with his murder.
Interior Minister Horst Seehofer proclaimed in March that right-wing extremism and right-wing terrorism were “the biggest danger for democracy in Germany”, promising a beefed up security response.