The space shuttle Columbia, poised on launch pad 39A for the last of four planned test flights, will be making the first secret mission ever flown in Earth orbit by the civilian space agency and hauling the first private-industry cargo as well.

Barring last-minute difficulties, astronauts Thomas K. (Ken) Mattingly and Henry W. Hartsfield will fly Columbia into space at 11 a.m. EDT Sunday.

A fierce electrical storm struck the launch pad late today with such violence that it triggered fire alarms. Hail the size of golf balls also battered the pad.

Small dimples were found in about 400 tiles on the wings, and body flap (brake). Technicians moved the huge circular gantry that shuttle maintenance workers use on the launch pad, back to within five feet of Columbia tonight.

This allowed technicians to erect temporary wooden scaffolding so they could fill in the dimples on the craft's aerodynamic surfaces with the same special glue used to cement the tiles to the spacecraft. Shortly before midnight, shuttle managers said the repair work was proceeding on schedule and the launch countdown resumed after a planned eight-hour hold.

"We do not expect to lose a minute from our liftoff time," Kennedy Space Center spokesman Charles Hollinshead said tonight.

Mattingly and Hartsfield's flight will complete the shuttle test flight program, but their mission has been upstaged by the secret cargo they are carrying into orbit for the Air Force.

Their private-industry cargo, a device built by McDonnell Douglas Corp. and Johnson & Johnson, may foreshadow an orbiting drug factory.

While the Air Force refuses to identify its cargo, it is no secret that the 2,000 pounds of instruments in Columbia's cargo bay include an infrared telescope so precise it can pick out engine exhausts in the Earth's atmosphere from orbit and tell whether they are the exhausts of high-flying aircraft or ballistic missiles, of machines made in the United States or the Soviet Union.

The cargo bay doors were opened last night to let technicians service the telescope with supercold liquid helium, which chills the telescope's sensors so they can distinguish the heat signatures of missiles and aircraft from Earth-reflected sunlight.

The infrared telescope is not the only secret cargo. Suspended from a trussed pallet in the 15-foot wide cargo bay is an ultraviolet telescope and a new space sextant that will be built into future Air Force spy satellites to navigate without guidance from the ground. The three secret devices mark a drastic departure from past policies of the National Aeronatucis Space Administration.

"One of the fundamental strengths of the NASA program is that it has been open, a strength we don't want to lose," Air Force Maj. Gen. James A. Abrahamson, associate administrator for space transportation, told reporters today.

"On the other hand," he said, "the shuttle was originally justified as part of a national system whose mission includes the launching of military payloads, some of which require extreme protection. We have made a compromise."

To hear the top managers of the space agency tell it, NASA and the Air Force have had few if any disagreements about how the space agency will fly classified cargo. For instance, the Air Force has asked the space agency not to televise pictures of its cargo and to assign astronauts of proven military background to flights that handle military cargo.

"We've agreed to these requests because we think they're reasonable," NASA Administrator James M. Beggs said today in an interview. "If they came in here with requests that raised my costs or changed my schedules, those would not be reasonable. They haven't done that."

The McDonnell Douglas/Johnson & Johnson device, carried in the mid-deck of the shuttle cockpit, will study the possibility of using the weightlessness of orbit to separate biological materials that cannot be separated on Earth.

The device works by a process called electrophoresis, where proteins, enzymes, hormones and antibodies that have their own natural electrical charge are separated from other biological materials in a static electrical field.

Inside the device will be a "soup" of egg albumin and rat albumin proteins that are so similar they are very hard to separate on Earth. It is hoped that the electrophoresis experiment will produce from 40 to 400 times as much of the two proteins in orbit as the same process could generate on Earth.

The two companies behind the experiment plan to fly the device twice more to verify their process, but the types of biological materials that will be flown the next times are secret.

If the electrophoresis experiment proves itself, McDonnell Douglas and Johnson & Johnson will install a 5,000-pound production unit in the shuttle in 1985. A device that large would produce 24 times the biological material as the cockpit experiment on this fourth shuttle flight.

Pending approval by the Food and Drug Administration, the two companies could have an orbiting drug factory producing the rarest of pharmaceuticals in 1987.

Columbia's classified cargo is by no means the sole or even major objective of the last shuttle test flight. Mattingly and Hartsfield's seven days in orbit are planned to iron out what few wrinkles remain in the way the 100-ton spacecraft soars into orbit like a rocket and comes back to Earth on wings like an airplane.

Once again, the shuttle will be baked in different attitudes in the scorching sun to see how Columbia handles the heat. For 66 hours, Columbia will fly with its tail to the sun, then for five hours with its cargo bay to the sun and for 33 hours with its bottom in the full glare of the sun.