Thousands of mourners surrounded the coffin containing five Torahs destroyed in a synagogue arson fire, and police have charged two youths with setting the blaze and spray-painting swastikas inside the temple.

Speakers at Sunday's funeral ceremony, which was attended by 10,000 people, compared the vandalism to Kristalnacht, the "night of the broken glass" in Nazi Germany that signaled the beginning of the Holocaust 50 years ago this November."How?" asked Rabbi Hillel David, whose Orthodox Congregation Rabbinical Institute Sharai Torah was heavily damaged in the blaze early Saturday, the Sabbath between the holiest days on the Jewish calendar - Rosh Hashana, new year, and Yom Kippur, the day of repentance that begins at sundown Tuesday.

"How can such a thing be that the holy Torah is destroyed by fire? A fire from men, from haters of the Torah?"

"The whole life is a life of tests. But I do not know what this test is." The Torah, the scroll containing the first five books of the Old Testament, are so holy that by Jewish law they are accorded a funeral.

After the 90-minute service, the coffin was carried through the crowd to a waiting station wagon. It was buried at a Jewish cemetery in Deans, N.J.

During the funeral, Mayor Edward I. Koch was applauded when he said the youths arrested "have to be assailed and have to be punished," despite their age, 12 and 15.

The boys were charged Sunday as juveniles with arson, burglary and criminal mischief, said Sgt. Raymond O'Donnell, a police spokesman.

The 12-year-old was accompanied by his mother when he surrendered late Saturday.

"She was very distraught about it so she called the police," said Detective Sgt. Willie Shaw. "That was our link to the 15-year-old."