The question was how Caspar W. Weinberger, whose performance starting with congressional hearings this week will make or break President Reagan's $1.6 trillion rearmament program, has done in his first two years as secretary of defense.

"If this were midterm and he were a student," answered former professor Rep. Newt Gingrich (R-Ga.), "I would say it would be a good time to send home a note saying, 'If you don't improve dramatically, you won't pass the course.' "

In so saying, Gingrich symbolized the middle ground of opinion on Weinberger, who will catch the political whirlwind beginning with his appearance Tuesday before the Senate Armed Services Committee.

Others interviewed recently were more and less charitable toward the embattled, enigmatic 15th defense secretary. Samples: "A-plus for advocacy. Cold, inflexible. Hasn't had a new idea in 30 years. One of the best."

No matter what people think of him, Weinberger is the biggest target in town. By representing his client, the president, so tenaciously on national defense for two years, lawyer Weinberger has provoked cases that would read much like this if filed in court:

* Budget director David A. Stockman v. Weinberger for failing to do more to reduce the federal deficit.

* Congress v. Weinberger for refusing to allow budgets cuts to be distributed fairly between domestic and military programs.

* Congress and Air Force v. Weinberger for bobbling the MX intercontinental ballistics missile.

* Congress v. Weinberger for shattering the nation's pro-defense consensus.

* Arms controllers v. Weinberger for scare talk and inflexibility.

* The Joint Chiefs of Staff v. Weinberger for failing to tell them what he is doing and why early in decision-making.

* Military reformers v. Weinberger for letting the armed services take the nation to the poorhouse in limousines.

Given all that, it was perhaps an understatement for Senate Armed Services Committee Chairman John G. Tower (R-Tex.) to observe in an interview: "This is Weinberger's toughest year, not only with Congress but with the administration, to hold the line on the defense budget."

Further confirming that Weinberger will be severely challenged, by Republican congressional leaders overseeing the defense budget among others, Tower disclosed that he will oppose Weinberger on the administration's proposal to freeze basic military pay at current levels. "They've got to have some kind of raise," Tower said of the 2.1 million men and women in uniform.

Tower reasoned that government civilians would not have to get raises at the same time because "the requirements imposed on military and civilian personnel are entirely different. I don't see that you have to link civilian and military pay."

Despite mounting opposition to staying the course on the Reagan defense budget, Weinberger is not expected to change his style.

Before Congress, he will almost certainly continue to be Reagan's cool, pleasant, but unyielding advocate. No matter what the question, he probably will supply one of his standard, all-purpose answers.

These include: past administrations allowed weakening of U.S. defenses; the Reagan administration is trying to make up for that neglect by making forces readier to fight today while ordering the weapons needed for tomorrow; the Soviet threat is real and growing; the nation can well afford Reagan's military buildup, especially since the Soviets devote 15 percent of their gross national product to defense compared to 8 percent for the United States; Reagan's arms buildup is providing jobs, the administration already has accepted big defense cuts.

Inside the Pentagon, his style must change because of the departure of his trusted deputy, Frank C. Carlucci. Weinberger, Carlucci and William Howard Taft IV have been the big three running the Pentagon for two years, with heavy assistance from Vince Puritano, a longtime Carlucci confidant. Organization charts do not plot the civilian power structure that way, but that lineup has been the reality at the Weinberger Pentagon, according to insiders.

"Cap was a guy born in a suit," a Pentagon civilian executive said. "He's pleasant to everybody butreally friendly with almost nobody. Frank ran all the programs; Cap didn't get into them and never believed it when Frank said he was going to leave. Only Frank and Will Taft could say no to Cap."

A top general who felt frustrated by Weinberger's modus operandi said: "After going through that first briefing with him, I said to myself: 'Now that's the dumbest S.O.B. I've ever seen.' But then I said: 'That can't be right, looking at the record.' "

After two years of close association with Weinberger and analyzing him, that general has decided this:

Weinberger and Carlucci started by trying to run the Pentagon as they did the old Department of Health, Education and Welfare. They set their sights on certain objectives but played their cards close to the vest. Then they found they could not control the Pentagon because it has too many constituencies, each with allies in Congress.

Also, according to the general, Weinberger is uncomfortable with technical matters, took over the job without the help of a transition team because he fired it and concentrated so hard on gaining congressional approval of Carlucci that he allowed other deputy positions to be filled with people long on ideology but short on administrative ability.

As a result, in the general's view, the military services pretty much got their way. The new question is whether Paul Thayer, who has replaced Carlucci as deputy defense secretary, can win Weinberger's confidence to the point that he is allowed to discipline the services in research and procurement and mend fences in Congress.

Another general said: ". . . It's a myth that Weinberger has a lot of friends in the military. I don't know anybody he socializes with. You brief him and leave the room never knowing how it went over, and lots of times he never tells us. At least with Carter administration Defense Secretary Harold Brown, he'd say, 'I'm not going along with you on this because of this, this and this.' With this guy, you just never know."

A Republican lawmaker with close administration ties expressed the same kind of frustation with Weinberger, a longtime acquaintance, as defense secretary:

"Can you imagine Mel Laird as secretary of defense going up to the Hill with the MX before he had the Joint Chiefs on board? He would have gone to them first and said, 'This is the way it is.' Imagine how I felt walking the plank for the MX, only to hear most of the chiefs were against it," a reference to the chiefs' doubts about the MX "Dense Pack" basing scheme.

How members of Congress from both parties feel about Weinberger will have much to do with how they treat him and his budget in this crucial year. Here is a sampling of such opinion from a wide range of interviews:

* Ted Stevens (R-Alaska), chairman of the Senate Appropriations subcommittee on defense: "You've got to give him an A-plus as an advocate. But I'd have to give him a B-minus in deportment because he is so difficult the way he guards his domain. It is frustrating to the point I want to scream sometimes. But every time I went back" to the subcommittee to fight for more money after Weinberger had refused to agree with cuts, "I got a little more."

Stevens said the biggest political problem confronting Weinberger "is the perception that support is waning for a strong national defense when it's not." The biggest weapons problem, he said, is the MX.

"The whole defense modernization program has been pulled down by the MX. He ought to build a common missile" for land silos and submarines rather than continue to fight the MX battle, Stevens said.

* Ernest F. Hollings (S.C.), ranking Democrat on the Senate Budget Committee, which sets target ceilings on Pentagon funding: "Weinberger has really destroyed the consensus that we had going for defense . . . . On arms control, he's the one that's terrifying people. They weren't afraid of [the late Soviet leader Leonid I.] Brezhnev; they were afraid of Cap Weinberger and this administration."

Because of Weinberger's scary talk about El Salvador, Cuba and prevailing in a protracted nuclear war, Hollings said, "You got all the folks demonstrating. When you talk in that fashion, you've got the poor president behind the curve on arms limitation.

"Whatever [Soviet leader Yuri V. Andropov] says they believe, and whatever the president says they don't believe. It should be the other way around. He's gotten the president in trouble in the international picture, and now he's getting him in trouble on his own defense budget."

*Joseph P. Addabbo (D-N.Y.), chairman of the House Appropriations subcommittee on defense who was last year's most successful budget slasher, said he will continue the effort this year. He said Weinberger "has failed in what we had hoped to have seen: a complete and in-depth oversight of the military portion of the Pentagon. He has in many cases rubber-stamped the desires, the requests of the military."

Given Weinberger's failure to weed out marginal programs, Addabbo said, Congress must do the job. "If we keep funding programs which are duplicative, there will be a tremendous bow wave, and I will almost predict a complete rebellion by the people of the United States and, as a result, the Congress. You'll see a complete swing of the pendulum all the way back. This will cut into needed systems and, most important, into operation and maintenance funds so necessary for our readiness," he said.

Asked what grades he would give Weinberger after two years on the job, Addabbo said: "A for effort, B for performance because when called before our committees he may not give us the answers we want, but he's been responsive. I would have to say D in regard to developing an effective military program. Congress has to take an equal responsibility."

* Jack Edwards (Ala.), ranking Republican on Addabbo's subcommittee on whom Reagan is relying to fight off Addabbo's proposed cuts, praised Weinberger's advocacy but faulted him for not doing a better job of advertising cuts already made in the president's rearmament program.

" 'Cap the Knife' was his name, and that was his fame," Edwards said. "One would have thought he would have come into the Pentagon and the knife would be very evident. In truth, whatever cuts he has made have not really been that evident.

"I'll give you an interesting statistic. The president proposed and Cap Weinberger proposed to increase the Carter increases by $116 billion over the next five years fiscal 1982 through 1986 . The president said . . . we've already cut out $58 billion of that $116 billion increase, so the Congress has fallen way short of giving Cap and the president what they've asked for. There's a feeling within the administration that somehow we just simply can't fall below the Carter numbers."

The public record shows that lawyer Weinberger, before some "juries" in official Washington, stresses cuts already made while, before others, he stresses how Congress approved almost all of Reagan's requested defense money.

Overall, Edwards said, he would give Weinberger a grade of B "on the basis he is, by and large, carrying out the request of the president." Edwards added that he does not blame Weinberger for congressional refusal to approve money last year to produce the MX and Pershing II missiles.

"I don't think there has been a question of a credibility gap on his part. I think it's been solely a question of how well the president, as only the president can do, has been able to sell to reluctant members the weapon systems of that type," Edwards said.

"It's no secret that everybody was asking Cap to tell us where we could best take some cuts last year, and he simply wouldn't tell us. He said to me one day at breakfast . . . , 'They say I'm inflexible, recalcitrant, unbending.' I said, 'They're right. You're all of those things.' He laughed."

* Rep. Dick Cheney (Wyo.), a widely respected Republican who served as chief of staff for President Ford, has been strongly supportive of Reagan's rearmament effort and welcomed the plan to base MX in his state. But he agreed with Gingrich that Weinberger is in trouble and with Edwards that some symbol of Pentagon economy is needed.

"More than anything else," Cheney said about the negative side of Weinberger's first two years, "it has been the failure to lay the groundwork to avoid that third-year falloff that has plagued every other administration" that has tried to implement a carefully crafted, five-year defense program. "This takes more than simply talking about the threat.

"The administration, the defense secretary, could have been far more creative from a political standpoint" by explaining to the public how many jobs are being created by the defense buildup, he said.

"Another area where a far more effective job could have been done is convincing people that we are, in fact, spending the money wisely. While Carlucci and Cap were working hard to impose reforms on procurement, and have got an impressive list of things they have done to improve things, nobody knows about it . . . . It did not do anything to convey to the country that we spend the money wisely.

"There hasn't been, for example, base closings. Lyndon Johnson got more mileage out of going around the White House turning off the lights. It didn't save any money, but it conveyed to the country that he was concerned about being frugal, spending money wisely.

. . . There are savings that can be achieved by closing some bases . . . . There's a great deal to be said for having the Congress debate and complain about the prospects of bases being closed as a way of conveying to the country that, 'Yeah, we're buying new aircraft carriers and weapons systems but, darn it, we're also going to root out that waste, fraud and abuse.' "

Partly because Weinberger has failed to convey that message, Cheney said, the defense budget "is going to get it in the neck in 1983, I'm afraid."

Two of Weinberger's toughest interrogators at the Senate Armed Services Committee starting Tuesday are likely to be Democratic Sens. Carl Levin (Mich.) and Gary Hart (Colo.). "He's a victim of his own rhetoric," Levin said. "He believes we're behind the Soviets in every major category of military capability even though the Joint Chiefs wouldn't swap our capability for theirs."

"The legacy of the Reagan-Weinberger defense spending spree is likely to be a monumental financial crisis which could make Weinberger go down as the defense secretary who did more than any holder of that office since Louis Johnson in 1949-50 to reduce this country's military strength," Hart said.

Weinberger sees himself not as a Louis Johnson but as a Winston Churchill trying to wake up a nation to a threat while there is still time. Starting Tuesday, with the help of charts and a new Pentagon book about the Soviet arsenal, he will try to persuade an increasingly skeptical Congress that Reagan's program to rearm America is the best way to avoid going to war.

Tower predicted that Weinberger, by making that case, will go down in history "as one of the great secretaries of defense."