Alfred E. Kahn, the nation's new anti-inflation chief, said yesterday he would prefer mandatory wage-price controls if President Carter's voluntary program fails, and if the only other choice for slowing inflation is recession.

"I suppose that if I am forced to choose between the two of them, I would just have to choose the controls," Kahn said of the possible choice of recession.

But he said emphatically that he does not expect to have to make such a choice. That would be "a sign of failure of what the president is trying to do" with his voluntary wage-price program, announced last week, said Kahn, who is in charge of making that program work, and he does not intend to fail.

"I know it was once said that whom the gods would destroy, they first make mad; and maybe I have been made mad. I do not intend to fail. And I don't think it it is necessary to fail," Kahn said on "Issues and Answers" (ABC, WJLA).

He insisted that the voluntary program will succeed because the American people are very aware of inflation, are tired of it, and want to put an end to it as soon as possible. That keen public awarness may even help to regulate wages and prices in hard-to-regulate industries, Kahn said.

"I am not accustomed to waving the flag. That is not the way I function," he said. "But I do really believe that, at this time, we have gotten such a recognition in the country of the importance of this problem that no one will want to be identified as being even in the tiniest bit responsible for breaking" the guidelines announced by the president last week.

Briefly, those guidelines call for voluntary limits of 7 percent on wage increases and 5.75 percent on price hikes. They also contain a tax rebate as "insurance" for workers who comply with the guidelines, if inflation exceeds 7 percent next year.

Kahn and Treasury Secretary W. Michael Blumenthal, who appeared on "Face the Nation" (CBS, WDVM), said the voluntary program has to be given a chance to work slowly.

The program "will have to remain in effect until it is claer that we have turned the corner" said Blumenthal, adding that this economic journey will take "at least a year."

Both Kahn and Blumenthal down-played the intitial stock market decline that greeted Carter's call for voluntary wage-price restraint. Kahn said that although the market reaction was "obviously disappointing," it does not mean the program can't work.

"I think the program . . . is admirable. I expect it to have an effect and I expect the effect to be visible, but not tomorrow," Kahn said.

Blumenthal said he foresees the shaky stock market eventually appreciating the merits of the Carter plan. "I have no dount that the market will reflect that in coming months . . . I think these programs take a while to analyze and understand," he said.