Labor Secretary Ray Marshall raised the possibility yesterday of selective economic controls if the Carter administration's latest voluntary restraint program fails.

In an interview, Marshall said he was confident organized labor's agreement to cooperate with business and government on a pay advisory committee will work. He also reiterated the administration's opposition to across-the-board economic controls.

But he acknowledged that the new venture "very well could be" the last chance for strictly voluntary measures, noting that "as we looked at the options to start with, everything else seemed to be pretty bleak."

He said he was speaking only for himself but added: "I think that the view would be shared by at least a number of others in the administration that if we don't make this work, then we'll probably have to go more to selective controls or some other technique."

Administration officials have been reluctant to talk about controls of any kind, and Marshall, in a subsequent clarification, siad he was speaking only of "public pressure" for controls, as opposed to administration thinking.

He said, "selective controls" would likely be in the nature of the administration's hospital cost containment legislation, aimed strictly at "areas that cause the trouble." He also suggested credit controls or allocations to relieve housing price pressures.

Controls of this kind would not be useful for price pressures caused by shortages, where, as in the case of food, efforts should be aimed at expanding and stabilizing supplies, he said.

Marshall's optimism about the outlook for the pay committee's success is not universally shared outside of the AFL-CIO and the administration, which jointly announced its formation last Friday as part of a "national accord" on economic policy.

Conspicuous among the skeptics are some key figures in the business community, the third partner in the tripartite effort. Irving S. Shapiro, chairman of duPont, has sharply criticized it as politically designed to woo organized labor, and Thomas A. Murphy, chairman of General Motors and head of the Business Roundtable, also has expressed reservations.

Murphy voiced concern that the pay committee may lead to wage and price controls, a warning that has also been sounded by the U. S. Chamber of Commerce in statements assailing the administration-AFL-CIO plan.

On the other hand, Marshall characterized business support for the pay committee as "overwhelming" and said he anticipated no problem in winning its full cooperation.

he 15-member pay committee -- five members each from labor, business and the public -- will be organized under the direction of John T. Dunlop, who was architect of the pay restraint effort in the Nixon administration. Although its powers are advisory only, it is expected to have a major role in shaping the guidelines and enforcement procedures during the coming year.

Appointment of members is expected to proceed slowly and sources indicate that guideline modifications may be made piecemeal rather than adopted as a whole by Oct. 31, as originally planned.

Labor's clout on the committee is expected to be enhanced by its ability to torpedo the whole effort by quitting, although Marshall said yesterday he believed labor would be constrained from doing so because of its concern over inflation, other economic interests and its image.