DETROIT, JULY 20 -- American Motors Corp., which is on the verge of being acquired by Chrysler Corp., said today it had its most profitable second quarter ever, with earnings of $30.2 million 17 cents a share).

The quarterly profit, which compares with a loss of more than $52 million reported during the second quarter of 1986, includes a tax provision of $17.9 million, which means AMC posted an operating profit of about $12.3 million.

"We felt they would make about $10 million, so they did about 20 percent better than we expected," said industry analyst Arvid Jouppi of Keane Securities Inc. of Detroit.

AMC spokesman Edd Snyder said it was the best second quarter since the car maker earned $18.9 million in 1974.

The latest results could be AMC's final quarterly report as an independent company if the Chrysler takeover is finished before September.

Chrysler last March proposed a buyout of AMC from French car maker Renault and AMC shareholders. In late May, a final offer was agreed upon, paying shareholders $4.50 per share.

The total value of the deal could cost Chrysler close to $2 billion, including about $1 billion in assumed debt from AMC.

Sales for the second quarter ended June 30 for what was once the nation's fourth-largest car maker rose to $1.2 billion, up from $800.8 million in the second quarter of 1986.

For the first half of 1987, AMC earned $53.7 million 29 cents), compared with a loss of $71 million in the first half of 1986. The latest six months included a tax provision of $32.6 million, meaning the car maker had an operating profit of $21.1 million.

Sales for the first half of this year amounted to $2.3 billion, up from $1.7 billion in the comparable year-ago period.

Chrysler is expected to report its second-quarter and six-month earnings Tuesday, with General Motors Corp. and Ford Motor Co. to report later this week.