The AIDS Law Project of Pennsylvania filed suit in federal court in Philadelphia in December, arguing that the school had violated the Americans with Disabilities Act in denying admission to a 13-year-old identified only as "Abraham Smith."
It sought to have the school reverse its decision and pay unspecified damages to the student and his mother, with whom he lives.
Hershey filed its answer on Friday night, a week after asking the court to move any trial from Philadelphia to Harrisburg, about 15 minutes from the school.
Such a move would be an immense inconvenience to the student and his mother, said Law Project attorney Ronda Goldfein, who plans to file an opposing motion on Monday.
The 1,800-student school, which serves low-income families, acknowledged that based on his 2011 application, Smith appeared to meet the "initial minimal qualifications" for admission.
After learning he was HIV-positive, however, it discontinued processing the application.
The school said in a statement that before acting, it had "weighed a number of complicated factors."
It asked the court to rule that its decision didn't violate the Disabilities Act because the student "would pose a direct threat to the health and safety of others."
The Law Project's suit faulted the school for failing "to make any individualized assessment as to whether Abraham's HIV status posed a direct threat."
In its response, the school said that while it has policies to control sexual behavior, evidence shows "that a significant percentage of its students will . . . become sexually active prior to graduation."
Smith's "needs cannot be accommodated without imposing an undue burden," Hershey's filing said. The school is "sympathetic" to the student's condition, "but must balance his rights against its obligations to the health and safety of other students."
Contact staff writer Anthony R. Wood at 610-761-8423 or twood@phillynews.com.