The Department of Justice has recommended that Patricia Hearst be freed, and President Carter is expected to commute the heiress' seven-year sentence in a few days, it was learned yesterday.

An administration source said the recommendation by Deputy Attorney General Benjamin R. Civiletti will be on Carter's desk late today when he returns from Camp David.

In a recent television interview, Carter said he did not plan to treat Hearst's clemency appeal as a special case and noted that he had "almost without exception" followed the Department of Justice's recommendation in such matters.

Carter has commuted the sentence of only four prisoners in the two years he has been in office. The commutation of Hearst's armed bank robbery term would be the most noteworthy clemency action since former President Richard M. Nixon cut short the prison term of the late James R. Hoffa, ex-president of the Teamsters Union.

Hearst, who is serving her sentence in the Federal Correctional Institution in Pleasanton, Calif., near San Francisco, has said she plans to marry her former bodyguard, Bernard Shaw, on Feb. 14 whether or not she has been set free.

Civiletti, who has been delegated all clemency matters by Attorney General Griffin B. Bell, advised Bell of his recommendation before sending it to the White House. Bell, asked about the Hearst petition as recently as Friday, would say only that it was "in process."

Bell has told friends privately that he feels that she should be freed. On several occasions he has said that the rich and powerful are sometimes unfairly treated when authorities bend over backwards in attempting to show there has been no favoritism.

Hearst has served 22 months of her sentence for participating with other members of the Symbionese Liberation Army in the robbery of a San Francisco bank. She would be eligible for parole July 11 even if she did not receive presidential clemency.

Her case has been controversial because she was kidnaped and treated harshly by SLA members before joining them in the bank robbery and a subsequent shooting incident at a Los Angeles area sporting goods store.

Many persons, including some public figures who have supported her clemency appeal, have contended that she was brainwashed before she joined her captors, an argument the trial jury did not accept.

Civiletti, discussing Hearst's case carlier this month, said any clemency action would not amount to second-guessing the jury that convicted her.

He said his recommendation would have nothing to do with her guilt or innocence, but would be " a matter of clemency and mercy."

Civiletti became more deeply involved in reviewing Hearst's clemency petition than is normally the case with such matters.

After receiving a recommendation in December from John Stannish, the Department of Justice's pardon attorney, Civiletti asked for more comparative statistics and personally studied a 3 1/2-foot-high pile of documents on the case. These included the transcript of her sentencing and psychiatric report.