GALVESTON, TEX., JUNE 11 -- After returning from an aerial inspection of the fire-ravaged Norwegian tanker holding 38 million gallons of oil in its damaged hull, Coast Guard Commandant J. William Kime said late today that he was "cautiously optimistic" that the Mega Borg would remain afloat so salvage crews can extinguish the flames and avert a potentially immense spill.

Kime spent more than an hour in a helicopter above the disaster 57 miles southeast of Galveston in the Gulf of Mexico. He said he saw fires raging aboard ship and in nearby waters as four salvage boats struggled to control flames by spraying them with water.

The stern listed precariously to port, and waves washed over it, Kime said. Ribbons of light crude oil only 10 yards to a half-mile wide and totaling perhaps 50,000 gallons floated on the surface, moving toward shore at a rate of about five miles a day.

"This is a medium spill at this point," Kime said. "The potential is what concerned us. But at this point, I am cautiously optimistic that the worst will not happen. It seems that all the right and necessary steps have been taken to control the fire and the spill."

The fire was expected to blaze at least through Tuesday morning, when crews are hoping to use chemical foam extinguishers. The salvage-master in charge of fighting the fire decided not to use the foam late today because the ship was too hot. The foam is sprayed from nearby tugboats and by men who board the ship.

Despite the inferno, there were several reasons for the optimism displayed by Kime and other officials here nearly three days after the Mega Borg caught fire at 1 a.m. Saturday, killing at least two crewmen, as a small amount of its oil was being loaded onto an Italian tanker.

First, the weather has been warm and calm, making it easier for crews to work and for spilled oil to evaporate. Kime said he expected perhaps as much as 50 percent of the oil to evaporate before it reaches shore. That compares with about 35 percent that evaporated after the medium spill at Huntington Beach, Calif., last Feb. 7.

Second, although several explosions aboard the 886-foot, single-hull ship Sunday led to official concern that it was about to sink, the vessel appeared to be steady today, and no further serious blasts occurred. This morning, some Coast Guard officers said the entire stern might be below water, but Kime said that was not true.

Third, the type of oil involved, while seriously toxic and dangerous to marine ecology, is less so than the almost 11 millions gallons of heavy crude spilled by the Exxon Valdez tanker last year in Alaska's Prince William Sound.

The Mega Borg is carrying light crude from Angola that evaporates more quickly and burns more readily than the Alaskan crude, according to Bill Taylor of the American Petroleum Institute in Washington.

Environmental officials were heartened by the optimistic signs but nervous. "We're still waiting," said Brian Cain of the Fish and Wildlife Service. "It's like sitting on a bomb."

Garry Mauro, the Texas general land commissioner and a leader of cleanup efforts along the Gulf Coast, said the state was not prepared for a massive spill, although its ports handle more than 200 million tons of crude oil every year.

"This is our worst nightmare," said Mauro, a member of the state Oil Spill Advisory Committee formed after the Valdez crisis. "There is no plan to deal with 38 million gallons of oil in the water. Anything that happens to deal with this crisis is going to be a make-do emergency plan."

There were glitches in the oil-disaster response here, which in some ways is being regarded as a test of what was learned after the Valdez spill in March 1989.

Most notably, many materials needed to fight the fire were not immediately available along the Texas coast. Some equipment had to be shipped from Louisiana and Alabama, while nozzles and tanks for the chemical foam used to extinguish such fires had to be flown from Rotterdam and did not arrive until 10 this morning, 57 hours after the crisis began.

"This is a free-enterprise operation, and we can't make the firefighting firms store equipment here along the Gulf if they don't want to," Coast Guard spokesman Rick Meidt said. "They keep the equipment where they think they need it and can make a profit using it. Fires of this magnitude are not common in the Gulf. They are common in the North Sea. That's why some of the equipment was over there."

Asked whether he was disturbed by how long it took to get the nozzles to the Texas Gulf, Kime responded: "We'll do an assessment afterwards to see if that was a problem that we should correct. It might be one of the lessons learned."

But Kime noted that, for the first two days, firefighters could not spray the chemical foam -- 20 tons at first and perhaps as much as 100 tons before the operation is over.

The fires presented disaster crews with a good-news, bad-news situation. On the one hand, the fires could sink the ship and lead to a spill about 3 1/2 times the size of the Valdez catastrophe. On the other hand, if the ship remained afloat, the fires burned off oil that might reach shore.

Although the Coast Guard had authority to federalize the cleanup, Kime said he is satisfied with work done by private firms contracted for the job by the ship's Norwegian owners. Firefighting is being handled by Smit American Salvage Inc. of Houston, while the cleanup is run by the felicitously named Oops, Inc., of New Orleans.

"I think they've acted very responsibly with this," Kime said of the shipping firm, K.S. Mega Borg II of Farsund, Norway. "So far, they've done everything they should have done."

State and federal officials decided Sunday to use chemical dispersants, a source of controversy. Many environmentalists note that the cleanup chemicals themselves are toxic and can have harmful effects on dolphins, fish and seabirds.

Officials accompanying Kime on the helicopter tour said that, at many places, dispersants appeared to cover more area than the oil.