Five years ago the National Transportation Safety Board did a "dry run" on how its team of air crash investigatos would react to the worst possible incident: a midair collision of two fully loaded Boeing 747s over New York City.

"We were so damn smart," said Charles Miller yesterday, who at that time was the head of the board's Bureau of Aviation Safety. "We emphasized strong measures to prevent that kind of accident; but nobody looked to the ground; but nobody ever thought about it happening there.

It was on the ground Sunday, on a simple one-runway airport on a small Atlantic island, that aviation's worst accident occured when a KLM 747 carrying 249 people slammed into a Pan Am 747 carrying 396.

Yesterday the Spanish government invited U.S. investigators to join in combing through the wreckage and determining what had happened: What mistake or series of mistakes led to the deaths of almost 600 people.

The U.S. experts will join Spanish and Dutch authorities in the investigation. In its early stages they will concentrate on finding and playing the recordings in the cockpits of the two aircraft and the air traffic control tape.

Pan Am said yesterday that its cockpit tape had been recovered and was being flown to Washington for study. A Spanish judge had seized the tower tape, the airline said.

Experts will also examine the pieces of the two aircraft and check for structural clues as to exactly what happened. If the two 747s were carrying full fuel loads, almost 100,000 gallons of it would have fed the holocaust that broke out on impact.

"This one is going to take weeks for us to sort out," one experienced investigator said. "All we know now is that it was foggy and the weather was bad when the crash occured."