WASHINGTON (AP) _ Pamela C. Harriman, the U.S. ambassador to France, will pay millions of dollars into two charitable trusts depleted by bad investments to avoid a conflict with the Internal Revenue Service, one of her attorneys said Saturday.

``Mrs. Harriman is committed to replenish the full amount that is determined to be owed to those trusts,'' said attorney William J. Perlstein.

He estimated the amount was $4.5 million.

Mrs. Harriman is embroiled in long-running legal disputes with the heirs of her late husband, W. Averell Harriman, a former U.S. ambassador to the Soviet Union and governor of New York. Among other things, the heirs have alleged that Mrs. Harriman misused the two trusts, borrowing from them or squandering the money on bad investments.

Perlstein said he did not believe that Mrs. Harriman had borrowed from the two charitable trusts.

``I believe there had been advances from another trust,'' he said.

The charitable trusts, which had held $6 million, were set up to finance the activities of the W. Averell and Pamela C. Harriman Foundation. The foundation has supported the study of international affairs at institutions including Columbia University, the Library of Congress and the Brookings Institution.

Perlstein said Mrs. Harriman believes she has ``substantial grounds'' to fight any claims that might be made against her regarding the two trusts.

``Although there has been no requirement that she replenish the trusts ... she's determined that she will make good on all these investments to make sure the foundation can continue to operate,'' he said.

He said the bulk of the principal had been invested in the mortgage for Great American Recreation Inc., a New Jersey theme park. The mortgage, currently in default, is guaranteed in part by park owner Eugene Mulvihill and Robert E. Brennan, a penny stock entrepreneur who has been convicted of defrauding investors.

Perlstein said Mrs. Harriman received written advice from her former attorney, Edmund Burns, that the mortgage investment did not violate IRS regulations against self-dealing, even though the Harriman family trusts had investments in a New Jersey hotel controlled by Mulvihill.

Perlstein said Burns' opinion may have been incorrect.

Last week, Mrs. Harriman backed out of a tentative $20 million settlement of the estate claims with her late husband's heirs.

According to papers filed in U.S. district court in New York, the deal began to unravel in recent weeks. Her lawyer, Roy Reardon, told U.S. District Judge John S. Martin that his client had tried hard to settle with the daughters, grandchildren and great- grandchildren of her late husband.

``She was basically giving up most of her liquid assets. She was also pledging, in effect, her property, her home and what she had in the way of assets and future income,'' Reardon said.

But he said the deal fell apart because lawyers for the heirs could not get her codefendants, including lawyers Clark M. Clifford and Paul Warnke, to pitch in another $3 million, a requirement of the tentative pact.

In lawsuits filed in Leesburg, Va., and in Manhattan last year, the heirs alleged that Mrs. Harriman and others had squandered $30 million of her late husband's fortune on bad investments. When Harriman died in July 1986 at age 94, he left more than $21.5 million to the heirs. He left $33 million to his wife and established an $11.6 million trust for her.