Officials said they received a tip of a student posting videos on social media of himself with a gun, pictures of himself with a gun in a school parking lot and threats to commit a shooting at Dwyer.
Investigators obtained a search warrant and found a firearm at the student's home, the sheriff's office said.
PBSO said the student confessed to making threats but said he was only kidding.
He also admitted the recovered weapon was the one seen in the videos.
The student, who is 17, was transported to the Juvenile Assessment Center and faces charges of possession of a weapon on school property, unlawful possession of a firearm, unlawful use of a two-way communication device, and false report concerning planting a bomb, an explosive, or weapon of mass destruction, or concerning the use of firearms in a violent manner.