After weeks of flailing wildly at the elusive target of Ronald Reagan, President Carter finally found a formula today to attack Reagan's positions without attacking the Republican nominee himself.

Sticking carefully to his prepared speech text, Carter contrasted his and Reagan's positions on a string of issues while appealing to a largely Jewish audience for help between now and Election Day.

The appearance was marred only by the presence of a handful of hecklers who stood to shout that the president had "sold out" Israel but who were themselves repeatedly shouted down by the crowd in the Forest Hills Jewish Community Center in the borough of Queens.

Despite the raucous scene between the hecklers and most of the audience that unfolded before him, Carter plowed through the speech, delivering probably the most strongly pro-Israel statement of his presidency before turning to domestic politics and the Nov. election.

"On one side is a Republican candidate who said a few months ago, 'Urban aid programs are one of the biggest phonies that we have in this system,'" the president said. "On the other side is a Democratic administration that has pushed through the first comprehensive national urban policy in our history."

Carter continued that litany through eight more issues, chiding Reagan for his stands on nuclear arms control, national health insurance, the Equal Rights Admendment and other subjects. He even injected a rare note of humor into what until now has been a grim crusade against Reagan, by contrasting the administration's support for federal aid to New York City with Reagan's past statement that he prayed daily that the government not "bail out" New York.

"Now I'm not saying that the Lord does not listen to the prayers of people who pray against New York," the president said. "I just think the people of New York outprayed him [Reagan] and all of us outworked him."

The audience, of course, understood that this was not only a jab at Reagan's stand on aid to New York -- which the GOP nominee has since reversed -- but a reference to Reagan's support from fundamentalist Christian leaders, at least one of whom has preached that God does not hear the prayers of Jews.

Reagan's abrupt reversal of his stand on aid to New York City and a number of other issues has deeply frustrated Carter and his aides. They entered the fall campaign believing that Reagan's almost two decades as a conservative spokesman would make him an easy target, and that he could be portrayed as a dangeroud political extremist.

But while the Republican nominee moderated his positions to broaden his conservative base, the president's attacks on him grew both more strident and ineffective, until Carter was forced to admit publicly last week that his harsh rhetoric had been a mistake.

There was a certain irony in Carter's less heavy-handed criticism of his opponent today. The president has frequently ridiculed Reagan as a captive of his own staff, afraid to speak without a carefully prepared text. But it has been precisely when the president has spoken extemporaneously and allowed his deep emotional antagonism to the Reagan candidacy to show that Carter's rhetoric has gotton him in trouble. Today the president stuck to the text.

Carter stopped in Queens this morning at the start of a full campaign day that later took him to southern Illinois for a tour of a coal mine and tonight to a "town meeting" in a suburb of St. Louis.

In West Frankfort, Ill., speaking outside Old Ben Coal Mine No. 25, the president warned miners against the dangers of weakening air pollustion standards to increase the use of coal. Without mentioning Reagan, who has criticized the Clean Air Act, Carter said that such a weakening of environmental standards almost certainly would produce a backlash against the use of coal.

Carter also announced that he has directed Douglas Costle, head of the Environmental Protection Agency, to include an analysis of the impact on jobs, presumably including those in mining, from any propsed amendment to the Clean Air Act, and to give "full consideration" to the jobs factor before supporting changes in the law.

In his New York address, while the militantly pro-Israel, pro-Reagan hecklers in New York popped up and down to denounce him, Carter devoted the first half of his speech to a reiteration of his support for Israel and his opposition to the Palestine Liberation Organization. Flanked by the flags of the United States and Israel, Carter for the most part ignored the hecklers as he pledged "never" to "turn his back on Israel" or to "reassess" U.S. policy toward Israel.

The tenuous nature of the political alliances that Carter hopes will carry him to victory in New York and elsewhere Nov. 4 was personified by the man who introduced him, Sen. Henry M. Jackson (D-Wash.). Jackson, very popular among American Jews, has criticized a number of administration positions, particularly on foreign policy.

But today he dutifuly introduced the president in Queens as the savior of New York City and the architect of the Egyptian-Israeli peace treaty who deserves "that special, extra effort" to be reelected.

Carter then traveled to Manhattan to pay homage to another important ethnic group -- Italian Americans. He signed a proclamation of Italian-American heritage week and marched near the head of the city's annual Columbus Day parade.