The ruling from the U.S. 3rd Circuit Court of Appeals in Philadelphia reversed a lower-court ruling made almost two years ago.
All members of the three-judge panel wrote their own opinion on the issue, which pits the right to free speech against the freedom from official establishment of a religion.
The judges agreed that the East Brunswick Board of Education's policy barring school staff from joining in student-led prayer was constitutional.
But the judges differed on what exactly a coach should do when his team prays.
From the time Marcus Borden became the Bears' coach in 1983, he was deeply involved in team prayers; for a time, he even led them.
In 2005, school officials received complaints that he was leading prayers and asked him to stop participating.
He sued the school board seeking to be allowed to bow his head and kneel when students led their own prayers. A lower-court judge found that should be allowed.
But Judge D. Michael Fisher wrote in the lead opinion Tuesday that Borden's past action of leading the prayers made his head-bowing seem inappropriate: "A reasonable observer would conclude that he is continuing to endorse religion when he bows his head during the pre-meal grace and takes a knee with his team in the locker room while they pray."
Meanwhile, Judge Theodore McKee wrote that kneeling or head-bowing would look like an endorsement of religion even to someone who did not know the coach had led prayers in the past.
And the third judge, Maryann Trump Barry, wondered what a coach should do in Borden's position. "Surely he would not be required to keep his head erect or turn his back or stand and walk away," she wrote. "Any such requirement would evidence a hostility to religion that no one would intend."
Barry Lynn, executive director of Americans United for Separation of Church and State, which represented the East Brunswick Board of Education in the case, said the Borden case shows that school employees should avoid looking like they're endorsing religion in any way.
"Extreme care needs to be given to any involvement by school personnel even with student-led religious activities because it's very easy to cross the line and find yourself over the constitutional cliff," Lynn said.
Borden's lawyer, Ronald Riccio, said he would ask the U.S. Supreme Court to consider the case to clarify what he says is murky law - especially given Tuesday's decision - about student-led prayer.
"As the matter now stands, some coaches can bow their head and take a knee," Riccio said.