The boy had reportedly been in contact with Ali David Sonboly, the teenager who shot nine people and then himself in Munich last Friday, via an online gaming forum.
Police were alerted to the boy's plans by a private individual who had been carrying out independent research on Sonboly, they said in a statement.
The researcher had come across the 15-year-old from Ludwigsburg, who had been in contact with Sonboly and had published photos and drawings which suggested he had been planning an attack.
After police investigations confirmed this suspicion, the youth was arrested early on Tuesday morning, and police carried out a search of his parents' home.
In a statement, police said they found “extensive evidence, including a larger number of small-caliber cartridges, several knives and daggers, evacuation plans of his school, and a large amount of chemicals, materials and instructions for making explosives”.
When interrogated, the boy admitted he had at one point been planning an attack on his school, due to suffering problems in his personal and school life, but said that he had since rejected the idea.
The 15-year-old has been taken into a youth psychiatric facility and police have confiscated the evidence, including electronic devices. It is thought that, like Sonboly, the boy frequently played first-person shooter video games.