Flushed by happy anticipation of yet another primary election massacre of Sen. Edward Kennedy, President Carter's political operatives in Washington were chilled by this warning from Mayor Edward Koch: Jimmy faces a "nip-and-tuck" battle with Ronald Reagan for New York in November.

"It's going to be very close," said Koch, advising the president to get out of the Rose Garden and up to New York for personal campaigning. That is shattering news for Carter strategists, who had considered this state as already won against Reagan.

The mayor's warning reflects political reality. The expected ease of Carter's primary win over Kennedy hides the president's unhealed wounds over Israel, aggravated by budget cuts of aid to New York City. Moreover, secret explorations have begun into running Republican Rep. John Anderson as the New York Liberal Party's candidate for president -- a move that would make it much harder for Carter to carry a state he cannot afford to lose.

What is happening here is part of a nationwide pattern: Carter's string of one-sided primary wins derived less from his strength than from Kennedy's weakness. Kennedy's failure to launch a credible New York campaign has led many supporters here to decide to stay home rather than waste their votes.

But anti-Carter Democrats who last summer pleaded with Kennedy to enter have not embraced Carter. An extreme case is Manhattan Burough President Andrew Stein, who admits "Teddy was not the man I thought he was." As for the president, Stein told us: "I don't see how I can vote for Carter." Other pro-Kennedy politicians may be less candid than Stein but are scarcely less hostile toward Carter.

Similarly, the opinion by Carter's political high command that the president has recovered from damage suffered when the United States supported the U.N. resolution critical of Israel is based on polls that show no Jewish leakage to Kennedy. That is partly testimony to the ludicrously inept campaign for Kennedy here.

State Attorney General Robert Abrams, an early Kennedy backer asked at the 11th hour by the senator's managers to help get the Jewish vote, urged that material exploiting the U.N. fiasco be mailed quickly to one million New York Jews. Preparation was anything but quick, and a cash shortage reduced the mailing to 250,000. At the last minute, a serious factual error was spotted in the material, and the entire mailing was scraped.

One Democratic leader who supports Kennedy admits that, even with a smooth-functioning campaign, "Kennedy could not be salvaged" among Jewish voters. The hostility toward him because of Chappaquiddick from older, lower-income Jews equals anti-Kennedy outrage anywhere in the Bible Belt.

Furthermore, Vice President Walter Mondale has worked overtime in New York following the U.N. controversy. Addressing a Cambodian refugee awards ceremony by the Jewish service organizaion, B'nai B'rith, Mondale changed the subject to reassure the Jewish leaders present of the president's support for Israel. Applauding Mondale warmly, they did seem reassured.

But outside the Jewish elite, few are reassured. Rank-and-file Jewish voters, however unfairly, express renewed doubts about how Carter as an evangelical Christian regards Jews. The tension continued when Carter national campaign chairman Robert Strauss referred to vocal Jewish critics as "emotionally hysterical nuts" and Secretary of State Cyrus Vance refused to totally condemn the now famous U.N. resolution.

Yet is it possible that traditionally liberal New York Jews could vote for right-wing bogeyman Ronald Reagan? Indeed it is, say Democratic leaders. Koch, who publicly complains about "Arabists" shaping Carter's Mideast policy, told us: "Reagan is very strong on Israel." With Irish and Italian voters moving toward the Republicans lately, no Democrat can carry this state for president without solid black and Jewish support.

Thus, Carter's problems are difficult enough without the John Anderson phenomenon. Anderson-for-President buttons abound in Greenwich Village, that weather vane of the trendy left. State Liberal Party leaders have begun seriously talking about denying their ballot line to Carter and giving it instead to Anderson, which could cost the president New York's vital electoral votes.

Mayor Koch's advice to the president is to publicly rebuke his "Arabists" and hit the New York campaign trail. But New York Magazine's report of a White House aide's venomous remarks against Sen. Daniel Patrick Moynihan for nonsupport of Carter in the primary suggests a mindset that the president has weathered the worst in New York and need not kowtow to Moynihan or any other Democratic leader here after Tuesday's voting. On the contrary, Carter's real problems with the Big Apple are just beginning.