State political leaders, riled over a local shipbuilding firm's loss of a multimillion-dollar government contract to a California concern, say the Carter White House spitefully withheld the contract in an effort designed to hurt Sen. Edward M. Kennedy.

"The voters in my district are very unhappy and when they're unhappy I'm very unhappy," said state Sen. Anna Buckley, a backer of the president and a national committeewoman. "He's making a big error."

"It's just another act of political insanity," said state Democratic Party Chairman Chester Atkins, a supporter of Kennedy's possible candidacy for the presidency. "The president is petrified of Massachusetts and he's trying to punish the state the best he can."

Rep. Nicholas Mavroules (D-Mass.) suggested the president was out to embarrass the Massachusetts senator for allowing draft-Kennedy drives to crop up nationwide and at the same time woo California's 45 electoral votes from another potential challenger, Gov. Edmund (Jerry) Brown Jr.

However, the White House denies it tried to influence the Navy's decision to award a $107.1 million contract to build a cable ship to National Steel and Shipbuilders of San Diego. Undersecretary of the Navy James Woolsey termed the charges "nonsense."

The low bidder, at $9.7 million, was General Dynamics Corp. of Quincy, Mass., the state's fifth largest employer and the source of one of the biggest payrolls in the heavily Democratic southeastern portion of the state.

General Dynamics, currently completing its only contract, will begin to lay off the first of about 4,500 workers next month, company officials said. State economic forecasters say the loss of the cable ship contract could eventually cost the region up to 20,000 jobs.

"Politicians in this area are going to have a hard time shilling for the president when their neighbors are out of work," said Rep. Brian Donnolly, an early Carter backer who led the aggressive lobbying effort to win the Navy contract for this Quincy yard.

Members of the state's congressional delegation have met with Navy representatives and White House congressional liaison Terry Straub. Sens. Kennedy and Paul Tsongas, several congressmen and Gov. Edward J. King also toured the shipyard with Woolsey recently.

King, one of the few outright Carter supporters in a state that holds the nation's second presidential primary, twice contacted White House aide Jack Watson to push the contract.

The effort was to no avail, said Woolsey, who cited the detailed procurement statutes and regulations drafted by Congress to insulate the contract procedure from politics.

"It was a normal, formal procedure, involving a technical assessment," he said. "This ship and this contract were handled in accordance with law and regulations and there was no White House involvement -- period."

Added deputy White House press secretary Patricia Bario: "The White House involvement was none. There was no intervention by the president or any White House personnel on his behalf."

However, the Office of Management and Budget audited the bids before the contract was awarded, Bario said, at the request of a member of the Massachusetts congressional delegation. Donnolly says no congressman from his state made that request.

"Who are they kidding?" said Mavroules. "I've been involved in politics for a long time and if the White House wanted Quincy to get that contract, they would have moved heaven and earth to do it."

Mavroules, a member of the Armed Services Committee, has received approval for a congressional probe into the contract.

Said Donnolly: "It wouldn't surprise me if somebody over at the White House found out the contract was about to go through and said, 'Hey, what are we doing a favor for Kennedy for?' and killed it."

But Bario says the charge of presidential retribution against Kennedy "has no basis in fact. I'm trying to kick this story as loudly and firmly and clearly as I can because it's absolutely false."

In an unprecedented move, General Dynamics has filed a formal complaint with the General Accounting Office, Congress' auditing arm. The Massachusetts congressional delegation has asked that the Navy not be permitted to honor the contract until a GAO investigation is completed.