After almost a decade of watching Japanese auto companies pocket profits selling compact pickup trucks to American motorists, Detroit is fighting back.

Detroit's Big Three all are producing new small pickups aimed directly at the Japanese producers, who sold more than half a million of the compact trucks last year, the bright spot in an otherwise grim year for truck sales.

General Motors Co. introduced the Chevrolet S-10 and its twin from GMC in November. The Chrysler Corp. Rampage followed in December and Ford Motor Co. will begin selling the Ranger pickup next month. American Motors Co. brought out a Scrambler compact pickup last year.

Of that group, the Chevrolet S-10 and Ford Ranger will be produced in volumes large enough to force a showdown with the Japanese. The two new U.S.-built trucks were deliberately designed to be different from the popular Japanese pickups in a costly gamble that the distinction will mean something special to truck buyers. The two new U.S. compact trucks are about half a foot longer than the Japanese compact pickups and half a foot shorter than the traditional U.S. pickup truck.

"We feel we've done something right," says Michael H. Erdman, truck sales manager for Chevrolet, citing the company's efforts to design a totally new truck from the ground up rather than down-sizing its larger, traditional pickups.

Erdman also feels that Chevrolet may benefit from a rare stroke of luck. The company introduced the S-10 with two choices of engines, a standard four-cylinder version--the kind found on all the other compact pickups--and a more powerful six-cylinder option.

Now, with gasoline prices holding steady, motorists are less energy conscious and the auto companies find themselves facing an unexpected interest in larger, more powerful vehicles. The six-cylinder engines are outselling the fours by a three-to-two margin nationwide, says Erdman. In California, the margin is 3 to 1 for the larger engine and in Los Angeles, 9 to 1.

Ford will try to persuade motorists that the Ranger is better built than any Ford truck ever. It will offer the same two-year free maintenance and repair guarantee on the Ranger that it now provides for its Escort and Lynx subcompacts.

Detroit's hopes for the new trucks are very high. They are counted on to reverse a three-year slump in truck sales and to capture a market the Japanese have had all to themselves. At a base price of about $6,300 without options such as air conditioning and power steering, the trucks should be profit-makers.

In 1978, the last boom year for Detroit, Americans purchased nearly 3.7 million light trucks--a record 30 percent of total sales by U.S. manufacturers. It was clear that a significant number of consumers were buying a truck instead of a second car, joining the tradesmen, contractors, farmers and other traditional pickup buyers. Last year, however, only 2.03 million light trucks were sold, and sales to customers for personal use were almost nonexistent.

The exception to that trend were the compact pickups, but that was slim comfort for Detroit.

Although pickup trucks have been a staple for the Big Three, they have had no compact pickups of their own and for years have imported Japanese-built models, selling them under their own names. Of the 523,619 compact pickups sold last year, 40 percent of these were these so-called "captive" brands, the Ford Courier, Chevrolet LUV, Dodge Ram 50 and Plymouth Arrow.

The other 60 percent were sold directly by Toyota, Nissan, Mazda, Isuzu and Volkswagen.

A critical question is whether the new American-built pickups will replace the "captive" Couriers, LUVs, Rams and Arrows.

When Chevrolet introduced the S-10 last November, it cut back hard on its orders for the Japanese-made LUV, bringing in only four-wheel drive and diesel models that GM isn't yet producing.

Since then, Chevrolet has sold 40,000 S-10 pickups, while LUV sales in December were 65 percent below the December 1980 figure, continuing to fall in January.

The Japanese producers, meanwhile, were pushing sales of trucks under their own names. Toyota is paying incentives of $300 to $500 per truck to dealers who exceed minimum sales goals.

The Japanese producers, however, are facing a 25 percent tariff on their imports that was imposed in mid-1980.

Until then, many Japanese compact trucks had been shipped to the United States in two sections, the cab with chassis and the truck bed. Once in this country, the parts were assembled, a method that importers said made them eligible for a limited, 4 percent tariff.

The Carter administration, heeding cries of help from Detroit, concluded the importers were sidestepping the law and ordered the full 25 percent tariff collected, adding some $650 apiece to the price of the Japanese compacts assembled here.

The move stopped what had been a sales coup by the Japanese, said auto industry analyst David Healy of Drexel Burnham Lambert Inc.

Foreign trucks had captured nearly 24 percent of the U.S. truck market in the fall of 1980 and appeared headed for a 27 percent share in 1981 before the full tariff was imposed.

The combination of the tariff and the new American-built models should hold Japanese imports down and open a wider market for the U.S. models, Healy said.

The January results provided some evidence of that. Sales of U.S.-built compact pickups were 34 percent higher than in January 1980, while the leading Japanese lines lost ground.

"The only things that are selling are the light pickups," said Healy and the new American models fit right into the segment.

But it's not yet clear whether the S-10, Ranger and Rampage are the huge successes that Detroit is hoping for. Healy believes that truck sales will not take off until auto sales do.