An American car cracked the 40-mile-per-gallon barrier for the first time in this year's official government mileage tests, but it needed the help of a Japanese diesel engine to do it.

The Environmental Protection Agency yesterday reported a 1982 Chevrolet Chevette diesel scored 40 mpg in the agency's laboratory tests of fuel economy, making it both the first U.S.-made car to average 40 mpg in the test and the first domestic model ever to finish in the top 10 in the mileage race.

For the fifth year in a row, Volkswagen was the big winner in the economy competition, sweeping the first four places. A VW Rabbit diesel with a four-speed transmission averaged 45 mpg in the EPA tests, the best mileage ever recorded. VW Rabbit and Jetta models with five-speed transmissions tied for second with 43 mpg and the four-speed Jetta averaged 42 mpg.

The top U. S. cars in the EPA ratings after the Chevette were the Chrysler Corp.'s twin Dodge Omni and Plymouth Horizon with 35 mpg, the Dodge 024 and Plymouth TC3, at 34 mpg and the Ford Escort and Lincoln-Mercury Lynx with 31 mpg. All have gasoline engines.

The EPA ratings showed dramatic increases in the fuel economy of American cars over the last three years. The best 1981 U.S. models ratings were the Chevette, Escort and Lynx--all averaging 30 mpg; the most fuel-efficient 1980 domestic model got only 26 mpg.

Under federal law, car makers are required to produce a fleet of 1982 models that average at least 24 mpg. All three major domestic makers say they will easily exceed that figure. Ford projects a 25 mpg corporate average fuel economy, General Motors estimates 26 mpg and Chrysler Corp predicts its cars will average 28 mpg, better than the 27.5 mpg the government requires for 1985 models, the last year of federally-mandated mileage standards.

Chevrolet improved the Chevette's economy by adding an optional 111-cubic inch diesel made by Isuzu, the Japanese auto firm partially owned by General Motors. GM officials said Chevrolet expects to sell 60,000 diesel Chevettes this year, about 17 percent of total Chevette sales.

The same engine used in the Chevette powers two Isuzu I-Mark models with four and five speed transmissions that averaged 42 mpg and 39 mpg, ranking sixth and ninth in the fuel economy ratings. Other cars in the top 10 were the Honda Civic at 41 mpg, and the Japanese-made Dodge Colt and Plymouth Champ at 39 mpg.

The full EPA ratings list of all foreign and domestic cars and light trucks will be published in Sunday's editions of The Washington Post.

The EPA tests are based on a simulated driving cycle carried out in a laboratory. While the the car's drive wheels spin on a treadmill, a driver starts, stops, shifts, speeds up and slows down according to a predetermined routine.

Because of criticism that the test results are unrealistically high, EPA has stopped reporting the separate city, country and combined average mileage figures and now puts out only the results of the city driving cycle. Manufacturers are free to use the other figures in their advertising.

EPA officials maintain that any inaccuracies in the test effect all cars equally, so the relative ranking of cars can be used to comparison shop.

Much of the improvement has come from adopting diesel engines which burn fuel more efficiently than gas burners. Seven of the top 10 in mileage ratings are diesels.

All of the top ranking cars use foreign engines. Besides the Japanese diesel Chevette, the Omni and Horizon models use gasoline engines made for Chrysler by Volkswagen.

Even though they are assembled in Pennsylvania, the top-mileage VW Rabbits are classed as imports by EPA because more than 25 percent of their parts are made abroad.

VW of America officials said yesterday their 1982 diesel Rabbit gets about three mpg more than the 1981 version because of a new feature that tells drivers how to improve their fuel economy. A small yellow arrow in the middle of the VW dashboard lights up when it is time to shift to a higher gear and will be standard equipment on all manual transmission VWs sold in the United States.

The worst mileage recorded in the EPA testing was an Italian Maserati four-door that guzzled eight gallons of gas per mile, but can race from pump to pump at 150 mph. For more leisurely, but still luxurious gas guzzling there are Rolls Royce Corniche and Camargue models that average 9 mpg and a Cadillac limousine in the 10 mpg class.