The departing Pentagon executive was asked an uncomfortable question: How could the Gilleece case happen in the first place -- and what can be done to prevent it from happening again?

Lawrence J. Korb, who has earned some wound stripes during almost five years as an assistant secretary of defense, circled the question for a while. Mary Ann Gilleece, who resigned her procurement policy job last week after conflict-of-interest questions were raised, had been a close Pentagon colleague.

Before Defense Secretary Caspar W. Weinberger stripped away most of his responsibilities early this year, Korb had also played a big role in the military procurement process. When "installations and logistics" was still part of his title, Korb had decided such questions as how many spare parts the Air Force and Navy should buy for their planes and ships. He did not pick the contractors or negotiate the contracts, however.

Gilleece, whose title was deputy undersecretary of defense for acquisition management, did not pick contractors or write contracts either. Her job was to recommend, for example, whether the bomber the Air Force was going to buy should be purchased under a competitive or sole-source contract; whether foreign countries should participate in the production of U.S. weapons; what should be done to prepare the U.S. industrial base for wartime production.

Even so, what Gilleece and Korb did often had an impact on defense contractors. Gilleece got into trouble by soliciting contracts from defense firms from her Pentagon office for private consulting work after she left government. Korb is leaving the Pentagon at the end of this week under no such cloud. But he is going to work for a defense supplier, the Raytheon Co., which ranked ninth among defense contractors in fiscal 1984 with $3 billion in contracts.

"Unless you're independently wealthy," which Gilleece and Korb are not, "you're going to need a paycheck coming in" when you leave a Pentagon job, Korb said as he began to wrestle with the question about the Gileece case. "So we need to devise some sort of system that gives you some some kind of moving room" when it comes time to look for a job outside the government.

What Gilleece and Korb had to sell to private industry included knowledge of what was what and who was who inside the Weinberger Pentagon. Prospective employers also must have figured that the two executives would have access to key defense officials. Gilleece promised to make connections for her clients in the brochure she prepared to solicit consulting contracts.

"Procurement Strategy Corp. will undertake efforts to represent the concerns of the corporation to appropriate officials of the executive and legislative branches of government," said Gilleece's draft contract.

Korb said he was careful to distance himself from his office when he went job hunting. But he said this is difficult under the current rules of employment for presidential appointees like himself, partly because there is no way to accumulate leave with pay.

"There ought to be a provision that for every year you serve" in government as a presidential appointee, "you ought to get a month's pay at the end of your service. After three years' service, you would have three months to go find another job." The government executive would have no involvement with contracts or decisions in that three-month cooling-off period, Korb said.

Korb, 46, taught at the Naval War College and Georgetown University and directed defense policies at the American Enterprise Institute before joining the Pentagon. He has no previous service in the defense industry.

Korb also believes that agency inspectors general should specify what kinds of contact federal executives are allowed to have with private industry. "The laws and the proscriptions are very, very, very vague," he said. "Mary Ann thought what she was doing was okay. She felt she had asked the lawyers" and received clearance to take steps to set up her private consulting firm.

According to some in attendance, Gilleece broke into tears last Thursday while saying farewell to associates, and repeated that she had believed that she had not broken any rules in soliciting future business. The Pentagon's inspector general said Gilleece had "violated the Department of Defense regulation on Standards of Conduct," but added that the rule needed clarification regarding "affiliations" and conflicts of interest.

Other Pentagon officials said Gilleece had been "incredibly naive," no matter what the government lawyers had told her, to believe that soliciting business from her office would not create at least the appearance of a conflict of interest.

Korb said he does not see any conflict of interest between his Pentagon job and his future employment as head of Raytheon's Washington office because "I have not been involved in procurement at all. I have had no contact with industry." He said he hopes to learn something about procurement, however, and take it back to the Pentagon some day during a second tour of duty. One problem with today's Pentagon, he said, is that few of its executives know the defense industry from the inside.

"After all, we're the only country in the world that really relies on the private sector to build us our weapons," Korb said. "In most countries the defense industry is almost part of the government." He saw no way to close the revolving door between industry and the Pentagon because the Defense Department needs the expertise of industry officials to administer its multibillion-dollar programs efficiently.

Looking back over the Reagan administration's military buildup, Korb said "we overestimated the ability of the government and the people to stick to a long-term defense buildup" when there are no international crises, such as the Soviet invasion of Afghanistan or Iran's occupation of the U.S. Embassy in Tehran, to provide a sense of urgency.

"Iran and Afghanistan laid the foundation for the buildup," Korb said. "Remember, even President Jimmy Carter had the defense budget with a 5 percent real growth when he left office."

He said the horror stories about overpriced toilet seats, ashtrays and hammers have been "devastating" to the buildup because it unified people across the political spectrum for an attack on defense spending. The question now before Congress is whether to approve a fiscal 1986 defense budget calling for only enough of an increase to cover inflation, or provide no increase at all.

Korb said that instead of these feast-and-famine cycles that make it impossible to get the most return on the defense dollar, the administration and congressional leaders should to try agree on a steady increase of about 3 percent between now and 1990. Although Korb did not mention it, former defense secretary Harold Brown made the same kind of recommendation before he left office.

Korb, one of the most affable executives in the Pentagon E Ring but one who never managed to break into Weinberger's tight inner circle, leaves office stripped of his logistic and reserve duties but still overseer of military manpower. Success here, he said, has been "my biggest source of satisfaction. There has been this astounding turnabout in the quality of people coming into the services and staying in. The key was the renewal of the spirit of patriotism in the country. My biggest disappointment is that we still don't have an adequate system to measure military readiness."