It has been a rough four years for Jimmy Carter and Helmut Schmidt, and when the president and the West German chancellor meet at the White House today or the final time during the Carter presidency, it will still be in what aides call a "troubled atmosphere."

The trouble is both short-term and long-range.

The immediate difficulties between Washington and Bonn lie in disputes over how much the Europeans should be spending on defense and over making the Soviets pay an economic price for their invasion of Afghanistan.

The longer-range problem lies in trying to persuade Schmidt -- as a key leader in Europe -- that unless Western Europe gives a better account of itself on these and related issues, eventually it will run into a serious public relations problem here.

At a time when Americans are being asked to make greater economic sacrifices and when some social programs may have to be cut to make room for higher defense spending, there is apt to be "an emotional public reaction" here to continued European passivity, says one senior White House official.Whether such a reaction is right or wrong, he says, it could lead to pressure for diminished American support for the North Atlantic Treaty Organization, calls for withdrawal of U.S. troops from Europe, a resurgence of neo-isolationism and an unwillingness to defend European interests in places like the Persian Gulf.

Schmidt and Carter have also had some personal difficulties with each other over the years, mostly due to utterances of the German chancellor about mismanagement or lack of leadership in Washington that have, one way or another, found their way back to the White House. It is somewhat true to form, therefore, that their last meeting comes after what some administration officials consider "tasteless" remarks by Schmidt recently about a "renewal of American leadership" under President-elect Ronald Reagan.

Other officials say that Schmidt was only stating what many Americans have said about the change in administration, but agree that it doesn't help the current atmosphere.

Similarly, remarks by Bonn's finance minister, Hans Mathoefer, were said to have "infuriated" the Carter White House. In a recent defense of Bonn's contributions to North Atlantic alliance strength, Mathoefer said West German soldiers did not use drugs and could read and write, remarks that were widely viewed as an indirect swipe at American GIs stationed in West Germany.

Schmidt, in recent days, has been back-peddling fast on his earlier statements that Bonn would be unable to meet its pledge of a 3 percent annual real increase in defense spending. This more recent position will probably ease things a bit here, and with the incoming Reagan administration. But it remains to be seen what Schmidt does when he gets back to Bonn.

There is, officials here acknowledge, an element of diplomatic tragedy in confronting Bonn on defense issues. The West Germans have the biggest and most well-equipped armed force among the European NATO allies, and for much of the past decade, especially while the United States was bogged down in Vietnam, Bonn outperformed Washington in terms of real percentage increases, beyond inflation, in defense spending. Yet West Germany's position within the alliance as a symbol is so crucial that if Bonn falters, there will be even less leverage to get countries such as Holland, Belgium and Denmark to meet their pledges.

"It is a paradox," says one top aide. "We are muscling the one that does the most, but we have no choice because the others, who are already supine, will get even worse."

But the larger question, senior officials say, is the more fundamental issue of the Europeans trying to protect their relationship with Moscow at all costs. It is, as top aides describe it, a European willingness to let the United States take the heat and the action, while Europe tries "to remain an island of detente, free from the turbulence of international events."

Europeans, another aide said, "seem determined to protect their trade with the Soviets and are relatively unwilling to spend enough on defense." Though the Germans have done better than most, and supported the U.S. Olympic boycott, administration officials say the United States has largely been unable to gain agreement with them and the other West European allies in the past year on economic sanctions against the Soviets for the invasion of Afghanistan.

"They have refused to admit," one official said, "that economic relations have a place in deterring the Soviets. We asked, after Afghanistan, that they end subsidized credits to the Soviet Union and that didn't happen. We asked that they not fill in behind American firms and that didn't happen."

Reports from Bonn this week indicated that the West German government may underwrite a huge loan to Moscow by a consortium of West German banks to finance a big natural gas deal.

It may be that Schmidt will get off on a better foot with the incoming Reagan administration. The chancellor was joined at lunch in New York yesterday by the former NATO commander, Alexander M. Haig, who is on Reagan's interim foreign policy board. He will also see Sen. Howard H. Baker Jr. (R-Tenn.), the soon-to-be Senate majority leader.

Baker, however, just last week voiced the same kind of concerns about divisions between Europe and America on the meaning of detente that Schmidt has been hearing from the White House.

Some of the most experienced administration officials also believe the German-American problems may not go away just with a change in leadership. Indeed, there is a view that Helmut Schmidt's best excuse for not doing the things that need to be done may be about to get on a plane for Plains, Ga. In this view, it will become harder and harder for Schmidt to continue arguing that successions of American leaders or generations don't really understand the German position.