Al Aqsa mosque compound, which Jews revere as a vestige of their two ancient temples, is in Jerusalem's Old City and at the heart of the Israeli-Palestinian conflict. Under a decades-old "status quo" arrangement with Muslim authorities, Israel allows Jews to visit on condition they refrain from religious rites.
Three Jewish youths who received a restraining order after praying at the site successfully challenged the police decision at Jerusalem Magistrates Court, which ruled on Sunday that their actions had not constituted a breach of the peace.
That prompted protests and threats from the Palestinians and a pledge from Israel that the status quo would be preserved.
A planned flag march by Israeli nationalists in the Old City on May 29 has further stoked tensions.
The state filed a counter-appeal on Wednesday with Jerusalem District Court, which found in favour after nightfall.
"The special sensitivity of the Temple Mount cannot be overstated," Judge Einat Avman-Moller said in her ruling, using the Hebrew name for a site Muslims know as the Noble Sanctuary.
A right to freedom of Jewish worship there "is not absolute, and should be superseded by other interests, among them the safeguarding of public order", she said.
In a statement to Reuters, Nati Rom, a lawyer for the defendants, said: "It is strange and regrettable that, in the 21st century, in a Jewish and democratic country, the basic human rights of Jews would be so harmed."
With Jewish visits increasing in number, including over the Muslim fasting month of Ramadan that coincided this year with the Jewish Passover festival, Palestinians have cried foul.
Jordan, a US-backed Israeli security partner that serves as custodian of Al Aqsa, has also voiced concern.
The flag march, scheduled for Sunday, marks the Old City's capture by Israel in a 1967 war. The annual event is resented by Palestinians who want the Old City for a hoped-for future state.
The US Embassy in Jerusalem urged vigilance on Wednesday, adding an advisory that US government employees and their families "cannot enter the Old City at any time on Sunday".