President Reagan, extolling the American economic system and rejecting claims that the United States has not done enough for developing nations, said today that this country can best help poorer nations by pursuing economic recovery at home.

Reagan, setting the stage for his participation next week in the 22-nation Cancun, Mexico, summit on international economic development, offered no specific programs, but said that private investment and free trade, not aid, are the keys to progress.

The president equated today's developing countries with the young United States and urged that the American model be copied.

"We Americans can speak from experience on this subject," Reagan said of development. "Few countries are less developed than we were when the original settlers arrived here. They faced a wilderness where poverty was their daily lot and danger and starvation their close companions."

Reagan recommended several times in his speech that developing countries, regardless of their specific problems, emulate the United States. "No matter where you look today, you will see that development depends upon economic freedom," the president said.

"It's a question of freedom versus compulsion, of what works versus what doesn't work, of sense versus nonsense," he told the World Affairs Council of Philadelphia in a luncheon speech.

White House officials described the speech to reporters as a major address although Reagan outlined the same posture toward the world's poor nations at the annual meeting of the World Bank and International Monetary Fund last month.

It was a speech certain to disappoint and perhaps anger some of the developing nations coming to Cancun. Mexican officials expressed anger even before Reagan spoke that Washington would stake out a position before hearing from the developing nations at the summit.

Reagan said today "we will go to Cancun ready and willing to listen and learn," but Mexican and other foreign officials suggested that the Reagan administration's decision to make a speech before the summit indicated the United States is not going to Cancun in a receptive mood.

In words apparently aimed at the leaders of developing nations who seek a new world international order more favorable to them, Reagan said that the international system is not perfect, "but people flirt with fantasy when they suggest it is a failure and unfair."

After his speech, the president said of Cancun, "We know we're going to walk into a hostile atmosphere." He told a citizens' group that some nations "simply want a policy of take away from the haves and deliver to the havenots."

Reagan's speech was interrupted briefly by three antinuclear protesters who unfurled a banner and shouted at him from the balcony of the Bellevue Stratford Hotel ballroom. About 1,000 other demonstrators with varied causes clogged the sidewalks around the hotel.

The president later dismissed the protesters, saying they had been against the arms race but should be making their protest in Moscow, not here.

The president tied together several of his administration's main themes, contending that the Soviet Union is a society in decline, praising the workings of a free marketplace and calling private investment "the lifeblood of development."

Reagan criticized the Soviet Union for not attending the summit.

"They simply wash their hands of any responsibility, insisting all the economic problems of the world result from capitalism, and all the solutions lie with socialism," Reagan said, as he cited the dismal Soviet agricultural performance as evidence that the Soviets have "had quite a long losing streak for a government which still insists the tides of history are running in its favor."

On the other hand, the president defended past U.S. assistance to poor nations.

"To listen to some shrill voices, you'd think that our policies were as stingy as your Philadelphia Eagles' defense," Reagan said. "There is a propaganda campaign in wide circulation that would have the world believe capitalist U.S. is the cause of world hunger and poverty. Yet each year the United States provides more food assistance to developing nations than all other nations combined. Last year we extended almost twice as much official development assistance as any other nation."

Reagan said two conclusions should be clear. "Far from lagging behind and refusing to do our part, the United States is leading the way in helping to better the lives of citizens in developing countries. And the way we can do that job best, the way we can provide the most opportunity for even the poorest of nations, is to follow through with our own economic recovery program to insure strong, sustained noninflationary growth."

Supporting his point that the United States could best help other countries by putting its own economic house in order, Reagan said that every percentage-point reduction in U.S. interest rates improves the balance of payments of developing countries by $1 billion; they do not have to pay so much interest.

And he reminded his audience that the United States buys about half of all manufactured goods exported by non-OPEC developing countries to industrialized countries. "In the last two years," he said, "these same developing countries earned more from exports to the United States than the entire developing world has received from the World Bank in the last 36 years."

In his general discussion of development, Reagan avoided the words of alarm many others have used about existing food shortages, growing indebtedness and lack of natural resources in the underdeveloped world.

Only at one point did he speak of an urgent need, saying that "increasing food production in developing countries is critically important--for some, literally a matter of life or death."

In his lone specific pledge, Reagan said the United States will continue support for the generalized system of preferences, an international agreement allowing the duty-free international trade of numerous items.

Administration officials told reporters the Reagan administration has no intention of increasing its international lending at a time of domestic budget cuts. While food stamps are cut back home, food aid abroad is not going to cost more dollars, they said in explaining the administration's coolness to demands that the rich nations do more to help the poor.

Later, the president flew to Whippany, N.J., to attend two fund-raising events for Republican gubernatorial candidate Thomas Kean. At a $2,500-a-couple reception, Reagan said of Kean, "We couldn't ask for a better spokesman for our cause."

Reagan noted that registered Democrats heavily outnumber Republicans in New Jersey but said many Democrats are willing to join Republicans in backing Reagan programs. The president criticized Kean's opponent, Rep. James J. Florio, for voting against the Reagan tax and budget cut proposals in the House.