President Reagan today pledged to "root out any case of government discrimination against minorities" but dodged the key question of whether he would favor extension of the Voting Rights Act in its present form.

"I regard voting as the most sacred right of free men and women," Reagan said in a speech to the 72nd convention of the National Association for the Advancement of Colored People. "We have not sacrificed and fought and toiled to protect that right so that now we can sit back and permit a barrier to come between a secret ballot and any citizen who makes the choice to cast it. Nothing will change that as long as I am in a position to uphold the Constitution of the United States."

Behind the rhetoric lies an unresolved debate over whether the Reagan administration will decide to favor extension of the Voting Rights Act, which applies mostly to southern states with a history of discrimination, or whether the president will yield to the desires of southern Republican chairmen and others and seek to apply the law to every state.

Supporters of the act say that making the law national in scope would dilute enforcement to the point where the law would become meaningless.

Reagan said today that he had not made a decision but that Attorney General William French Smith is studying the options. The president has said he will announce his decision by Oct. 1.

"I emphasize that we will not retreat on the nation's commitment to equal treatment of all citizens," Reagan said today. "That, in my view, is the primary responsibility of the national government."

He was introduced by NAACP chairman Margaret Bush Wilson, who poked fun at his failure to address the convention last year. Reagan said at the time that his staff had misplaced the invitation, and Wilson said today: "I understand he has a much better staff now."

Introducing the president to a convention that opposes many of the administration's objectives, Wilson said, "The NAACP does not necessarily subscribe to the views which are about to be expressed."

On Air Force One, returning from Denver, deputy White House chief of staff Michael K. Deaver said Wilson's introductory criticism of Reagan "was unfortunate, if you're trying to build bridges."

Speaking to one of the few audiences he has faced that is not committed to his economic program, the president delivered a toughly worded defense of those proposals, saying that it would be a mistake to single out blacks for special treatment and adding that "government is no longer the draft horse of minority progress because it has attempted to do things it is not equipped to do."

The central theme of the Reagan message was that the poor and minorities will be helped most by marked improvement in the economy.

"The well-being of blacks -- like the well-being of every other American is linked directly to the health of the economy," Reagan said. "For example, industries in which blacks have made significant gains in employment, like autos and steel, have been particularly hard hit. Last-hired, first-fired is a familiar refrain to many black workers . . . . A declining economy is a poisonous gas that claims its first victims in poor neighborhoods, before floating out into the community at large."

The president said he would "not concede the moral high ground to those who show more concern for federal programs than they do for what really determines the income and financial health of blacks -- the nation's economy."

It was Reagan's way of saying that he is sticking by the budget cuts, which NAACP executive director Benjamin Hooks last week said, after a visit to the White House, disproportionately harm black people, 40 percent of whom are below the poverty line.

In that meeting with Hooks, Reagan alluded to the words of President Kennedy that "a rising tide lifts all boats." Hooks came out of the White House and said, "The thing that a non-swimmer most fears to hear is the coming of a rising tide. We have a lot of non-swimmers."

Without mentioning Hooks by name, Reagan referred back to that comment in his speech today.

"Yes I know it has been said: what about the fellow without a boat who can't swim?" Reagan said. "Well, I believe John Kennedy's figure of speech was referring to the benefits which accrue to all when the economy is flourishing."

At the NAACP session, Reagan got the coolest reception of his presidency. He was politely applauded when he began and when he finished his speech, but was interrupted with light applause only twice -- once when he praised the "sound educational investment" of black colleges.

While Reagan did not tell the NAACP audience what it wanted to hear about the Voting Rights Act, there are those in the White House who say that the president is likely to opt for a simple extension of the law and let any conflict be resolved by Congress. A backhanded recognition of the way Reagan may be leaning came recently from southern members of the Republican National Committee, meeting in Washington, who asked Reagan to support the act but apply it to all states.

"We took this stand because we thought it was the best we could get from the White House, and we may not get even that," one prominent southern Republican said after the meeting.

Post-speech comment from the NAACP came in the form of a presentation of black and brown jelly beans to Reagan by Hooks and Wilson.

"I must tell you there is one white jelly bean in there someplace," Hooks said as the president laughed.