A New Jersey student who set up a web site threatening a bloody rampage during his school’s homecoming weekend must pay the $13,000 tab for the havoc his site created, a judge has ruled.

The 17-year-old Pequannock High School honor student was hoping to frame other students who had mocked a friend of his on a “Loser of the Month” web site.

Instead, the district canceled sporting events and postponed homecoming, and officials were forced to find other venues for games and practices.

The youth’s web site “canceled every recreational activity in the township of Pequannock and Pompton Plains over a three-day period,” Pequannock High School principal Paul Palek told a judge April 20.

In addition to reimbursing the school district, the boy also was sentenced to 45 days in Morris County’s juvenile lockup and 18 months probation. The youth’s name was withheld because he is a juvenile.

The boy’s friend, Matt Kallback, was frequently a target of mockery at the school, and the boy saw himself as Kallback’s protector. The teen did not, however, tell Kallback what he planned.

Prosecutors said the teen was trying to make his own site, which also featured threats to put a hole through Kallback’s head, look like Kallback’s enemies had posted it. He even notified school officials about the site.

The web site eventually was traced to a Wayne computer company where the boy worked part time.

The boy pleaded guilty in March to making terroristic threats. “Not a day goes by that I don’t regret the choice I made,” he said. “I didn’t think about the pain that it would cause everybody.”