The alleged threat was at Albion Middle School in Albion, which is about 35 miles west of Rochester.
The threat was reported to a middle school staff member late Monday afternoon, according to Albion police.
Three students, who allegedly communicated through the messaging app Discord, had set a date to plan to kill or injure students with explosives and guns, police said.
Police described the threat as credible, but not imminent. Authorities did not disclose the date the students had allegedly set.
The three students, all of whom are under 16 years old, are charged with second-degree conspiracy, police said. They were not identified because of their ages.
While there was no specific motive, the plot was initiated after one student was upset over being "shunned" by a classmate, said Joseph Cardone, the district attorney for Orleans County, where Albion is located.
No specific students were targeted, Cardone said.
Several "legally possessed" firearms have been seized, according to police.
The students involved "have been removed from school pending the completion of the investigation and disciplinary and other corrective action to ensure the safety of our students," Michael Bonnewell, superintendent for the Albion Central School District, said in a letter sent Wednesday.
He described reports of middle school students sharing "inappropriate and threatening messages and images" through Discord.
Sean Li, director of Trust and Safety at Discord, said in a statement that the company wants it to be a "positive and safe place for all our users."
"We have a zero-tolerance approach to harassment and illegal activity on our platform and take immediate action when we become aware of it," Li said.
New York Gov. Andrew Cuomo warned that "any person posing a threat to our schools will face the harshest possible penalty under the law -- whether or not they intend to actually execute that threat."
"School and police officials across this state continue to be on high alert and I encourage anyone who notices any unusual or suspicious behavior to report it to school administrators and law enforcement right away," Cuomo said in a statement on Friday.