The Montgomery County Sheriff's Office said the 14-year-old was in between classes on Wednesday and yelled, "I have an AK-47 in my bag."
The sheriff's office said witnesses reported the incident to the school administration and identified the student responsible.
In a reminder on Wednesday, MCSO said that "threats to a school, even in jest, are no laughing matter," adding that "it is illegal to communicate false reports about emergencies, including bombings, fires, or other threats that can incite panic or result in emergency responses."
The student now faces a state jail felony of false alarm or report.