The fire inside the Wilberg Mine flared out of control early this morning, forcing rescue teams to withdraw to safety and leave behind bodies of 25 coal miners they had located in a grim three-day search.

The dead were among 27 miners trapped in the mine when a fire started Wednesday night. Rescuers repeatedly entered the mine in hopes of finding survivors, but found three separate groups of bodies and gave up hope for the two men who were not located.

The flare-up, which bellowed smoke that was visible for miles, prompted federal officials to begin sealing off the mine for an indefinite period. Late this afternoon, the entire area was evacuated after firefighters detected leaking methane gas that threatened to explode in the mine.

With access to the mine blocked, a sharpshooter was carried by helicopter over the mine in an unsuccessful effort to shoot out a backup diesel generator that was blowing air into the fire. The generator was activated automatically when firefighters withdrew from the mine and shut off the main electrical fan.

"This is feeding the fire and we've got to cut down on the fire," Emery Mine Corp. spokesman Robert Henrie said.

The new outbreak of fire and the methane buildup mean that the official investigation into the causes of the accident -- the worst U.S. coal mine disaster in 14 years -- will be delayed for weeks, officials said.

"The fallout of this is so difficult to absorb . . . that the numbness will have to take some time to wear off," said Utah Gov. Scott M. Matheson, who toured the mine area today. "After that, a complete investigation will be mandatory."

The decision to abandon the rescue operation brought further anguish to this community, which had clung to the hope that the 27 miners trapped inside Wilberg Mine since Wednesday night could be saved.

But late Saturday, the company announced that the bodies of 25 of the 27 had been located and that there was no further chance of finding survivors.

The rescue teams had covered the 25 bodies and started to remove them to the main mine shaft when the fire flared out of control about 2:30 a.m.

Asked why the rescue teams had not pulled the bodies out of the mine earlier, Henrie replied: "The number one obligation and the number one purpose for them being in the mine was to locate survivors."

"For 27 men to lose their lives -- it's got to affect hundreds of families here," said Joe Vendetti, who worked on one of the rescue teams. "This is Christmastime and now, on top of that, the families are looking at their loved ones being left behind in a coal mine."

As the reality of the disaster sank in this morning, hundreds of residents in the isolated mining towns of central Utah assembled at church services and union halls.

At San Rafael Catholic Church, parishioners sobbed uncontrollably as hats were passed to collect money for the families of the victims.

"These men had been doing work of love going down into the bowels of the earth for their fellow men, knowing what was ahead of them," said the Rev. Joseph E. Schuh. "That is a comfort to them and that is a great comfort to us."

While the mourning began, however, new questions were being raised about safety conditions in the mine.

Federal records show that there were 264 safety violations at the Wilberg Mine in the last two years and 32 since Oct. 1, even though the mine workers had been on strike for about a month this fall.

Union members have also questioned the longwall-mining operations that the miners were using when the fire started. Most mining tunnels have four entry and departure points but the tunnel known as "Fifth Right" had only two entry points.

"What you had there was no way out," said one miner, who asked not to be identified.

United Mine Workers President Richard L. Trumka had charged last week that Emery Mining officials' efforts to set a world-production record at the Wilberg Mine may have jeapordized workers' safety. But UMW officials here were reluctant to criticize the company publicly until they complete their investigation into the accident.

Federal officials said the accident rate at the Wilberg Mine was three times the national average in 1982 but had improved significantly since then.

The accident rate in 1984 was close to the industry average of 10.06 for every 200,000 man-hours worked, they said.

Company spokesman Henrie again defended the company's safety record, saying it was comparable to that of other coal companies. "For anyone to assume or allege that this was caused because of a safety violation -- the evidence is not there," he said. "That kind of innuendo damages the company."

Federal officials have speculated that the accident could have been caused by an electrical malfunction on the conveyor belt that was hauling coal out of Fifth Right. But the evacuation today will delay any formal finding for months.