Stewart Ramsay, 16, spent time in custody after being arrested in connection with an incident at a school in Perthshire on Friday.
He appeared in the dock handcuffed to a guard at Perth Sheriff Court and denied the allegations.
Mr Ramsay, of Coupar Angus, denied posting homophobic messages on Facebook on March 20 in which he threatened a 14-year-old boy with violence.
The messages are alleged to have been grossly offensive, or of indecent, obscene or menacing character, and the offence is alleged to have been aggravated by prejudice relating to sexual orientation.
It is alleged Mr Ramsay then attacked the same boy the following day by repeatedly punching him on the head and body to his injury. The allegation, also denied, is also said to have been aggravated by prejudice relating to sexual orientation.