A small but determined band of 12 workers ended their strike at AFL-CIO headquarters yesterday after winning a 52.3 percent pay raise over four years.

The labor-versus-labor confrontation ended after 12 days, but not before it had emptied the federation building for two days and forced embarrassed AFL-CIO officials to seek an injunction against their union brethren. The strike was the first at AFL-CIO headquarters in 15 years.

"It was pretty messy, but unfortunately it was necessary," said Sandra Polaski, administrative officer for Local 35 of The Newspaper Guild, which represents the strikers employed by the labor federation's Food and Allied Service Trades (FAST) department.

Although it involved only a handful of workers, the strike proved embarrassing to leaders of the 13-million member federation because about 400 other headquarters employes honored the FAST picket line and the AFL-CIO was forced to seek an injunction through the National Labor Relations Board to limit the extent of FAST picketing. The NLRB action is still pending and may be withdrawn, sources said.

The settlement, reached with the assistance of the Federal Mediation and Conciliation Service, will increase the pay of researchers, health specialists and other professionals from its current average of $17,000 to $27,000 over the life of the contract, Polaski said, while pay for clerical workers will reach $24,000.

Compared with the national average of about 3 percent for annual union pay increases, the FAST settlement is extremely generous, Polaski said, with a 16 percent raise in the first year. The agreement also will establish an individual retirement plan.

"The pay increases are very impressive, but then the wages were so low we could have used even more," she said. The strike began, according to FAST, because its employes are paid considerably less than workers who performed similar jobs for other AFL-CIO departments, which bargain separately with several unions.

Several AFL-CIO officials privately criticized Robert Harbrant, FAST's president, for failing to reach a settlement sooner. Harbrant declined to comment on the critics, saying, "I am glad we came to an agreement . . . . If I knew how we could have avoided this, I would have tried it."

FAST, which conducts studies and assists 15 unions in the fast-growing service sector, has long been a popular training ground for young people seeking their first jobs with the labor movement. Frequently, they moved on to other jobs, with higher pay and benefits, at major labor unions.

But when a growing number of FAST employes remained at the department for longer tenure, dissatisfaction with pay and benefits increased, according to present and former employes.