A Manhattan synagogue opened its doors to hundreds of worshipers from a nearby mosque ravaged by fire — a move that brought people to tears.

“Their Imam said this was the holiest moment he has experienced in New York. It is certainly one of ours as well. Salaam. Shalom,” Central Synagogue Rabbi Angela Buchdahl wrote in an emotional Facebook post.

The Islamic Society of Mid-Manhattan on 55th Street was closed when a fire ripped through a popular Mediterranean restaurant on the ground floor of the building Wednesday, NBC News said.

The mosque occupies the upper floors of the building, and hundreds of Muslim worshipers arrived Friday hoping an FDNY inspection would be finished in time for their prayers, or Jummah, in the early afternoon.

“Hundreds arrived for afternoon prayer only to find they couldn’t enter their mosque,’’ Buchdahl wrote. “So we invited them to pray at Central Synagogue.”

More than 600 Muslims ended up walking a block west to the synagogue at 55th Street and Lexington Avenue and filled its indoor pavilion.

The Muslim worshipers left their shoes in the hallway, and a hand-washing station was quickly prepared, since the ritual is part of Jummah.

Central’s senior cantor, Daniel Mutlu, told The Post that the two congregations formed a bond from the experience.

“The most incredible part of the day, besides getting to experience their worship in our space — which was just a symbol of people coming together in a climate where there’s so much perception of disharmony and not getting along — was when they were streaming out of the pavilion following their service, the gratitude and love coming out of each one of them was palpable,” he said.

“They were just so grateful to have been welcomed into our space, and we felt the same, that we could be together in that moment.

“As the imam preached, we’re all praying to the same source of life. We might do it a little differently. We might have a different background. But we’re all really doing this for the same reasons.”

Worshiper Marise Hausner told The Post it was a “profoundly moving experience.”

“When they came out, there were so many, ‘Thank you’s. Several people came up to me to shake my hand and thanked me. I said ‘You’re welcome, and Salaam Alaykum.’ ”

“It’s a good feeling to know that we made a little, tiny repair in the breach.”

Rabbi Stephanie Kolin, also at Central, told the website Forward, “It was one of the most beautiful sights I’ve seen in my life,” adding that many people in the room were in tears.

In his sermon, the mosque’s imam called it “the most blessed moment of my life in New York.

“I feel very good for all of you,” he said in a video shared online. “You were able to be part of this historic moment in New York, to show your children and your grandchildren, to witness the love and the care of our neighbors who show us their love and solidarity.”

“Light can come out of the darkness,” he added, referencing a massacre at two mosques in New Zealand earlier this month that killed 50.

Mutlu said the synagogue will be hosting them again this Friday as the Muslim worshipers don’t believe the mosque will be yet up to code.