ASSIUT, Egypt (AP) _ Sparks from a makeshift food stall were blamed Wednesday for a fire that killed 47 Christian pilgrims, most of them children, who had camped outside a monastery to pay homage to the Virgin Mary.

Hundreds of tents lay in smoldering heaps in the wake of the Tuesday night blaze fed by exploding butane lamps.

Witnesses said monks quickly closed al-Muharraq Monastery's massive front door after the fire broke out, and some of the dead were trampled as panicking pilgrims rushing to the door turned back toward a gate in the fence around the campground.

About 5,000 pilgrims were at the monastery for the Feast of the Consecration of the Church of the Virgin.

Held every June 21-28, the feast commemorates the farthest south that the Holy Family reached in its flight to save the infant Jesus from King Herod's order that newborn boys in Palestine should be slain. The monastery is built on the cave in Mount Qousqam where Coptic Christian lore says Joseph, Mary and Jesus were sheltered.

The church, called the Church of the Cave, has its altar atop a stone where the Holy Family is said to have rested. The altar is dated 747.

Neither the church nor the monastery, a 10-acre compound with 70 to 80 monks in residence, was damaged in the tent-city fire.

A senior provincial security officer for Assiut, the governorate capital 240 miles south of Cairo, said 26 children, 15 men and six women died from burns, smoke inhalation or from being trampled. He said 15 others were injured trying to escape.

The blaze began when sparks from the food stall, which provided pilgrims with tea, coffee and sandwiches, set afire nearby tents, he said. This in turn ignited about three dozen butane lamps, said the officer, who spoke on condition he not be identified.

The officer said the stand's two owners, both Copts, were arrested, but that the fire clearly was an accident.

''There was a big rush from the pilgrims toward the main gate of the camp. Some children fell and were trampled to death,'' he said.

A survivor, who appeared dazed, said eight pieces of firefighting equipment arrived from nearby villages but not until ''a full hour after the fire started.'' He said there was no water at the tent city to fight the blaze.

A preliminary police report estimated damage at $420,000. Several of the burned tents were occupied by merchants catering to the pilgrims, many of whom were camped for the duration of the religious festival, or ''moulid.''

In Egypt, such festivals are common among both Moslems, almost 90 percent of the 54 million Egyptians, and Coptic Christians, whose ancestors gave to the world the concept of monasticism.

Unlike most monasteries, whose ascetic founders in the first years of Christianity usually wandered away into the desert for solitude, al-Muharraq Monastery is relatively accessible. It is in al-Qusiyyah, near a well-traveled route and the Nile River about 35 miles north of Assiut.

Moreover, because of its importance to the Copts as the southernmost haven for the Holy Family in Egypt, its moulid is among the most famous in the Coptic Orthodox Church, founded by St. Mark.

Al-Muharraq formerly was called the Virgin Mary Monastery. Anba Sarabion, the Coptic bishop for public services in Cairo, said it took its current name apparently because of the reddish color of the rocks in the area. The name means ''The Burnt Monastery.''