President Reagan awarded a medal today to the founders of a boys' club in a poor, black neighborhood of this depressed city, commending the men for serving 2,000 inner-city youths and getting a $1.85 million recreational facility built without any assistance from the government.

In the spanking new gymnasium of the Mathews-Dickey Boys Club, amid a sea of small black boys in colorful baseball uniforms, Reagan said the club, built with contributions from private industry, was proof that "we do not have to turn to the federal government to fill every need.

"Don't misunderstand: government has a legitimate role in aiding citizens who can turn nowhere else for support," he added. "Business, volunteer organizations and our churches cannot take over all of America's responsibilities. But our economy nearly foundered on the rocky misconception that government bore those responsibilities alone."

Reagan's pitch for his "private sector initiatives" program, his reminiscences of the exploits of Dizzy Dean and Leo Durocher when he was a baseball radio announcer in the '30s, seemed to sail right past the children.

But the gym erupted with loud applause and cheering when he accepted the gift of a Mathews-Dickey T shirt and baseball cap.

The event here today was one of several planned by White House aides with the aim of portraying Reagan as a caring, compassionate president without racial prejudice. Later, in an interview with a local television reporter, Reagan bridled when reminded that he was very unpopular with minorities and the poor. The president suggested that the perception may result from the failure of the press to reflect his views fairly.

It was after that interview that Reagan disclosed the resignation of Murray L. Weidenbaum as chairman of the Council of Economic Advisers.

After the boys' club visit, Reagan stopped briefly by a fund-raiser for his alma mater, Eureka (Ill.) College, in one of St. Louis' most exclusive neighborhoods. Later, he spoke at a $250-a-person fund-raiser for the U.S. Olympic Committee honoring August A. Busch III, the head of the Anheuser-Busch brewery.

He was also to meet with his older son, Michael, who arrived here late this afternoon as part of an Anheuser-Busch crew on a powerboat that broke the speed record for the 1,027-mile Mississippi River run from New Orleans to St. Louis.

At the boys club, Reagan presented the Presidential Citizens Medal to Martin Mathews and Hubert (Dickey) Ballantine, who founded the boys club 22 years ago under a shade tree. The club has since grown to a full year-round sports program of baseball, basketball, soccer and boxing with a paid staff of six and more than 200 adult coaches and volunteers.

The adults who were in the bleachers of the boys club seemed especially moved today when Reagan invoked the name of Franklin Delano Roosevelt and remembered how he also had once spoken to a group of young people, lamenting that "one of the reasons the world gets better so slowly is that too many young people lose their dreams when they get older."

Reagan said, "The young people he spoke to then, now have grandchildren your age and still we have not achieved their vision of an America without poverty, without unemployment, free of class struggles and in a world at peace. I think we've accomplished much, but there is so much more to do."

Earlier today in Washington, Reagan invoked emergency powers to bar a second labor organization, the United Transportation Union, from striking the nation's railways. Reagan, who this month established a three-member board to handle a strike threat by the Brotherhood of Locomotive Engineers, named the same members to a board to study the issues in the second dispute.

The action imposes a 60-day cooling-off period, averting a strike set for July 30.