When Jimmy Carter was running for president, one of his issues was divided government.

A Republican president and the Democratic Congress would continue to confound each other, he said. A congenial Democratic president would get things done.

But it hasn't worked out that neatly; Carter's legislative program is in deep trouble. Examples:

The energy bill he sent to the Capitol a year ago and called urgent appears to be foundering.

The Panama Canal treaties, after a hard-won first victory, may be coming unglued because of Panama's objections to an amendment permitting U.S. military interference.

The House is heading toward some rollback of Social Security tax increases, despite Carter's opposition.

Over Carter's opposition, a move to give tax credits for tuition is gaining steam in both bodies.

Congress is striving to enact a dramatic increase in farm subsidies, against Carter's wishes.

The administration had given up on tax "reform," and its tax cut proposals are being challenged by the House Budget Committee.

The ink was hardly dry on Carter's new urban policy when the Senate Budget Committee tentatively voted against the public works jobs portion and the countercyclical aid to cities portion.

Civil Service reform, part of Carter's promise to reorganize the government, is in trouble.

Carter got less than he wanted on hospital cost containment.

A Carter-backed consumer protection agency proposal was defeated.

Welfare reform is languishing, and Carter may have to accept a less compreshensive plan in order to get anything.

National health insurance is on the shelf.

Carter's problems with Congress were at first chalked up to inexperience. Leaders complained that he was throwing too much at Congress at once, that his liaison work was faulty and that he failed to understand the need for political trade-offs.

But, they said confidently, he would learn.

In fairness to Carter, he inherited many tough problems requiring solutions that would be unpopular no matter what he did, such as energy, Social Security financing, and the Panama Canal issue. He also took on many tough issues in an effort to get the administration moving and live up to his many campaign promises.

But the disenchanement with Carter in Congress has taken a new turn. Polls show the perception of an inept leader growing, and members of Congress returned from the Easter recess saying they picked up that feeling from constituents.

"The Carter administration is generally not faring well," said Rep. Leon Panetta, a first-term Democrat from California, who conducted several "town meetings" with his constituents. "Last year it was a question of inexperience. The question now is whether the president has the capacity needed for leadership."

The public questioning of Carter's competence has led House members, whose terms all expire in the fall, to grab the bit in their teeth and bolt from control of both the president and the congressional leaders.

The economic issues make them most jittery. The falling dollar, growing inflation, lack of business confidence sends tremors through Congress.

In California, where an initiative on a June ballot seeks to limit property taxes, Panetta senses "potential for a revolt by middle-class taxpayers."

This feeling explains the rush to roll back Social Security taxes, increase tax reductions and pass a tuition tax credit.

However, a member of Congress also wants to increase spending for the constituency, whether it be farmers, the elderly, cities or the unemployed.

The effect of that, warns House Budget Committee Chairman Robert Giaimo (D-Conn.), is to drive up the deficit and worsen inflation. He tells House colleagues inflation could be as dangerous politically as taxes.

"They're schizophrenic," said House Democratic whip John Brademas of Indiana. "They always want the budget cut in somebody else's district," Brademas explains the jitters as stemming from the fact that half the 435-member House has been elected within the last six years and hasn't much experience in weathering elections. Also, he feels that a decline in party loyalty among voters and expanded business spending in political campaigns is putting pressure on the younger members.

But Brademas feels the questioning of Carter administration competency is real and is a prime contributor to his problems with Congress.

"I think there is a competency problem in some areas," Brademas said. He blamed Carter's advisers for allowing him to become embroiled in too many difficult foreign policy questions at once while not involving him soon enough in domestic questions that were snowballing out of control.

On the foreign policy front, Carter faces problems in selling war planes to Israel, Egypt and Saudi Arabia, lifting the Turkish arms embargo and handling the neutron bomb, in addition to Panama and strategic arms limitation talks with Russia.

On the domestic front Brademas blames Carter for not developing his own position on a farm bill, before Congress ran away with it, and not making clear now his preference on Social Security adjustments before, once again, Congress acts without him.

"I would be happier if he were more explicit," Brademas said.

Carter's problems have a spillover effect on the leadership. Tip O'Neal, who was building a reputation as one of the House's stronger speakers, finds himself increasingly unable to control his members.

In recent weeks, he has suffered losses on bills ranging from election campaign financing and tuition tax credits to White House staffing and even creating a park in Lowell, Mass.

"Judging the mood of the House these days is difficult," a senior Democrat said. "But if you had to put a label on it, it would be apprehensive. If Carter doesn't get his act together soon, it just may be too late for anybody to regain control."