In a major setback for Mayor Marion Barry that could undermine his entire financial program, the city's Public Employee Relations Board ruled yesterday that the District government must begin collective bargaining over this year's wages with the 14 unions that represent city workers.

Barry's tenuously balanced budget for this fiscal year includes only enough money to give the 32,000 workers a 5 percent cost-of-living increase. The unions are demanding at least the same 9.1 percent that federal white-collar workers received when the fiscal year began Oct. 1.

Yesterday's ruling by the labor board, known as PERB, did not deal with how much money the workers will receive. It merely ordered the city to bargain with the unions, which effectively overrules the mayor's unilateral decision to hold the wage increase to 5 percent.

District Budget Director Gladys Mack issued revised figures yesterday, saying that it would cost the city an additional $29 million to give its workers the 9.1 percent raise. That money would either have to be raised through taxes or saved by laying off 4,370 employes. In the public schools alone, already hit by extensive layoffs, another 1,000 workers would have to be dismissed.

The PERB ruling could be appealed to D.C. Superior Court. Donald Weinberg, the chief labor negotiator for the city, said no decision would be made until the ruling had been reviewed by Barry, City Administrator Elijah Rogers and the Corporation Counsel's office.

Barry is out of town, and will not return until Sunday.

A. L. Zwerdling, the attorney for the union coalition, said he was "happy to receive the decision," adding that "we call upon the mayor and his representative to commence immediately collective bargaining for wages." Barry had argued earlier that while he supported the principle of collective bargaining -- a right that the unions have been given for the first time -- it was "not a practical or legal reality" to begin this year.

The District's Comprehensive Merit Personnel Act of 1979, a 354-page document now being applied for the first time, conferred the right of wage bargaining upon the workers. In the past, they generally received the same salaries and annual raises as their federal counterparts and negotiated only about working conditions. That same act created the PERB to supervise bargaining and resolve labor disputes between the city and its employes.

The catch in that complex act was its provision that the city could bargain only with groups of workers in similar jobs. The unions already in existence, which have in their ranks workers of widely varying occupations, were not necessarily to be certified as bargaining agents for the employes. As the start of the fiscal year approached and no certifications were issued, the mayor decided it was too late to bargain about wages this year and went ahead with the 5 percent raise.

But on Sept. 30 -- at what Barry called "the 11th hour and 59th minute" -- the unions submitted to PERB a handwritten petition, asking that they be collectively certified for this year only so that negotiations could take place. The PERB, which is chaired by former secretary of labor W. Willard Wirtz, granted that petition yesterday.

The pay issue is crucial to Barry's financial program because salaries account for 70 percent or more of the city's operating budget. Faced with a cumulative deficit estimated at $409 million, he has committed himself to cutting city spending and balancing future budgets without further tax increases. Yesterday's ruling, if implemented, will complicate that task because interviews with union leaders indicate that they are in a truculent mood and unlikely to be persuaded by Barry's claim of poverty.

The PERB ruling represented a remarkable tactical victory for the unions. When they formed the coalition that submitted the petition, it marked the first time that they had cooperated in their common interest. In the past, union members said, they have been rivals more often than partners.