The United States and China signed a five-year agreement yesterday on Chinese textile sales in this country, ending a bitter, year-long trade dispute that sparked a Chinese boycott of U.S. farm products and cost American farmers as much as $600 million in lost sales.

The new agreement, signed in Peking, allows the Chinese an average annual growth of 3.5 percent in textile exports to the United States--about half of its quota in the agreement that expired in December. The new amount, however, far exceeds the 1 percent increase originally offered by the Reagan administration and gives China considerably more generous growth rates than the less than 1 percent granted to the big three among textile exporters--Hong Kong, Taiwan and South Korea--in agreements reached last year.

The pact was signed in a simple ceremony at the Chinese Trade Ministry by U.S. Ambassador Arthur Hummel Jr. and Zheng Tuobin, vice minister of foreign economic relations and trade.

Besides the diplomatic pressure from the Chinese, who at one point called the American position "rude and unreasonable," the White House found itself caught between powerful, conflicting domestic interests.

The farm lobby, spearheaded by Senate Finance Committee Chairman Robert Dole (R-Kan.), pressed President Reagan to give in to the Chinese in the interest of resuming wheat and other agricultural sales to China. At the same time, textile interests used the special access of two conservative, textile-state Republican senators, Jesse Helms of North Carolina and Strom Thurmond of South Carolina, to push the White House to stand firm on low quotas.

In the end, it appeared that the combination of China's strategic importance to the United States and the loss of farm sales overwhelmed the textile interests. China, moreover, argued that it deserved higher quotas than the other major suppliers because it was a late comer to the American market, the largest buyer of cloth and apparel in the world.

American textile manufacturers and union leaders bitterly assailed the new agreement when it was reached late last month during a seventh round of talks in Geneva. Their observers at the talks stormed out of the city in the midst of negotiations after sending a telex plea to the White House to order a change in the U.S. negotiating stance that led to the agreement.

Although no details of the agreement were revealed then, it was described as "a disaster" by Kurt Bernard, director of the New York-based Federation of Apparel Manufacturers.

The American Textile Manufacturing Institute in Washington withheld comment yesterday, saying it was waiting for details on the exact quotas.

According to information released yesterday in Peking, the agreement sets quotas on textiles in 33 categories--five more than the three-year pact that expired in December--and covers 70 percent of all Chinese textile sales to the United States and 90 percent of the most profitable garments.

Chinese textile sales to the United States reached $834 million last year, but it was the rapid increase from the 1979 level of $69 million that alarmed the domestic textile industry into its intense lobbying effort.

Farm sales to China, however, are far greater than textile exports, amounting to $950.8 million in the first six months of 1982. Because of the Chinese boycott on purchases of U.S. wheat, soybeans and cotton, farm sales dropped drastically in the first half of this year to $347.1 million. This sharp decrease contributed to the $33.6 million U.S. trade deficit with China for the first half of 1983 compared with a $662.7 million trade surplus during the same period last year.

Textile talks with the Chinese have been under way since last August. When the previous agreement expired in December the United States on its own limited China's 1983 imports to the 1982 level with no allowance for growth.

The Chinese retaliated with their ban on purchases of U.S. farm goods.

As a result of the no-growth limits, moreover, textile shipments, especially millions of dollars' worth of back-to-school children's clothing, piled up in bonded warehouses in the United States. These goods are likely to be allowed into the country as a result of the new agreement, trade sources said yesterday.