Ending a bitter struggle, the J. P. Stevens Co. today signed 2 1/2-year settlements with members of the Amalgamated Clothing and Textile Workers at 10 plants in North and South Caroline and Alabama. aIn return the union has called off a four-year boycott of Stevens products and a concentrated campaign to isolate Stevens from the rest of American companies.

That campaign included pressure on companies whose officials joined the J. P. Stevens board of directors and on companies that had J. P. Stevens officials on their boards. One company that faced strong pressure was Sperry, the giant computer maker. The effort also sought to withhold union pension fund monies from companies that did business with Stevens. Pension funds are major investors.

Both sides tried to put the best possible face on the agreement, which ends a 17-year effort by the ACTWU and a predecessor union to organize the giant textile company's plants, most of which are in the South.

Whitney Stevens, chairman of the $1.8 billion corporation, said that as part of the settlement the union has agreed to stop pinpointing Stevens as a primary target and to give up many of the unusual organizing tactics it has been permitted by the courts. Stevens viewed the agreement as a victory for the textile company.

But, Stevens said in a statement at the firm's New York headquarters today, there were "important things the settlement does not do:

"It does not provide any better wages and benefits at locations where we have recognized the union than in our other plants it does not restrict the company in opposing future union organizing efforts.

"The company continues to be openly and strongly opposed to unions in its nonunion plants," he said.

Asked how the settlement had been reached, Stevens said only, "The initiative for change came from the union."

Murray H. Finley, president of the textile workers union, said that Stevens has firmly resisted unionization for 17 years and now there are unions in 10 Stevens plants in four locations.

"We now cover more workers than in any other company except Fieldcrest. If that is a Stevens victory, we look forward to more Stevens victories in the future."

The agreement, which was signed here today, calls for:

A collective bargaining agreement among 3,000 workers at seven plants in Roanoke Rapids, N.C., and 500 other workers at plants in High Point, N.C., Allendale, S.C., and West Boylston, Ala. Roanoke Rapids workers unanimously approved their contract late today.

An end to the consumer boycott and the financial campaign.

Back raises totaling nearly $3 million for Roanoke Rapids workers, who were the only ones denied an 8.5 percent pay increase Stevens granted the rest of its employes in July 1979.

The union to guarantee that it will no longer make Stevens the "primary" target of its organizing activities, although the union can continue to try to organize workers at Stevens plants.

The union to give up special court-ordered organizing remedies such as the ability to be inside the plant. Finley said the ACTWU will continue to try to unionize Stevens plants using normal tactics such as leafletting, mailing, home visits and activities at the gates to the mills.

Appointment of an as-yet-unnamed arbitrator to police the agreement. About 80 percent of the nation's nearly 1 million textile workers remain nonunion. Most of those workers are in the South. At Stevens, another 60 to 70 plants and about 30,000 workers are still not under the banner of the ACTWU.

However, several more plants where the union's status is being contested in the courts may come under the agreement signed today depending upon the ruling of the court.

Any other Stevens plant that is organized within the next 1 1/2 years will be guaranteed a contract like the one signed today at Roanoke Rapids for 2 1/2 years.

While Stevens, the nation's second-largest textile maker, will continue to resist union activities at its remaining plants, Finley said that he expects the opposition to be civil and legal.

Stevens has been cited numerous times over the last several years by the National Labor Relations Board for illegal antiunion activities.