President Carter, acting in what he called "the interest of equity and fairness," yesterday commuted the 20-year prison sentence of Watergate burglar G. Gordon Liddy to 8 years imprisonment.

The President's action means that Liddy, the 46-year-old mastermind of the 1972 Watergate break-in who refused consistently to cooperate with prosecutors, will be eligible for parole from federal prison on July 9 - almost four years ahead of his scheduled parole eligibility under the 20-year sentence.

White House deputy press secretary Rex Granum, who announced the decision, said Carter's action was based largely on the length of sentences imposed on other figures in the Watergate scandal.

"The President took this action in the interest of equity and fairness, based on a comparison of Mr. Liddy's sentence with those of all others convicted in Watergate-related prosecuions," Granum said.

Among the other Watergate defendants cited by Granum were former Attorney General John N. Mitchell and former Nixon White House aides H.R. (Bob) Haldeman and John D. Ehrlichman, each of whom was sentenced to 8 years imprisonment.

Granum said it was "doubtful" that Carter would commute the sentences of Mitchell, Haldeman and Ehrlichman to less than the 8-year, commuted sentence he approved for Liddy.

Mitchell and Haldeman have remained free pending appeals of their convictions. Ehrlichman began serving his sentence last year.

Liddy, a shadowy former FBI agent, conceived the Watergate burglary idea and won approval for it from Nixon administration and campaign officials. One of the seven original Watergate defendants, he was sentenced is January, 1973, to up to 20 years imprisonment and fined $40,000 for his role in the break-in at the Democratic National Committee head-quarters at the Watergate complex.

U.S. District Judge John J. Sirica, who imposed the original sentence, later sentenced Liddy to an additional 18 months in prison for his refusal to testify before a grand jury what was investigating the Watergate cover-up.

In June, 1975, Sirica, who had reduced the sentences of some cooperative Watergate defendants, refused to reduce Liddy's sentence, saying he had shown no "remorse or sorrow" for his role in the scandal that eventually toppled former President Nixon.

In his action yesterday, the President did not lift the $40,000 fine that Sirica imposed on Liddy. However, Granum said that while Liddy, if he is ever financially able to, would have to pay all or part of the fine, his inability to pay the fine will not affect his eligibility for parole beginning July 9.

Last September, Liddy's lawyer, George W. Higgins, petitioned former President Ford to commute Liddy's sentence to the time he had then served and to erase the $40,000 fine. It was then approaching the height of the presidential election campaign and no action was taken on the request.

Last February, Higgins renewed his effort in a meeting with Carter's White House counsel, Robert Lipshutz.

According to Granum, Lipshutz relayed the request to Attorney General Griffin B. Bell, who last Thursday recommended to the President that he commute the sentence to 8 years.

Liddy is an inmate at the federal prison at Allenwod, Pa., a minimum security institution. He is the last of the original Watergate defendants still in prison.