A federal judge yesterday upheld President Carter's claim of executive privilege and refused to order the release of White House documents dealing with a decision to block a federal grant to a Texas antipoverty organization.

U.S. District Court Judge Gerhard A. Gesell ruled that there was no evidence of "any wrongdoing" by the White House in connection with the case and that, therefore, the president could not be compelled to surrender the documents being sought by Texas organization.

The case involves a decision by the Community Services Administration (CSA) last year to withhold an $855,000 grand to the Zavala County Economic Development Corp.

The Mexican-American organization, in the South Texas community of Crystal City, has feuded frequently with Texas Gov. Dolph Briscoe Jr. and has been aligned with Hispanic forces seeking to establish a third political party to challenge the state's Democratic establishment.

In a suit filed last December, the Zavala organization alleged that CSA's decision was the result of political pressure from the White House, which it contended was seeking to placate Briscoe and the Texas congressional delegation.

Noel H. Klores, a lawyer for Zavala, sought a court order for 21 documents, many of them internal White House memos to Carter, dealing with the grant.

Yesterday, Gesell upheld the White House's claim that 12 of the documents were protected by attorney-client privilege.The other nine documents, he ruled, were protected by the president's claim of executive privilege.

Executive privilege - a claim that oral and written communications between the president and his aides are privileged and may not be disclosed without the approval of the president - was widely used invoked in the Nixon White House in connection with the Watergate case. Carter aides have approached the subject gingerly, fearing any connection in the public mind with the Nixon era.

It was the second time that Carter has successfully invoked executive privilege to prevent the release of documents. The first time, earlier this year, involved a New York case dealing with shoe import tariffs.

Most of the documents that Gesell ruled were protected by executive privilege were memos to the president from Joseph Aragon, an aide to White House political adviser Hamilton Jordan.

William Z. Elliott, a Justice Department lawyer representing the White House argued that Zavala was denied the grant because of defects in its program. To force Carter to surrender the documents, he said, would "seriously undermine" the free flow of advice and information in the executive branch.

When Klores argued that the flurry of White House memos to the president about Zavala early in the Carter administration indicated an unusual amount of political interest in the small Texas organization, he was cut off by Gesell.

"Suppose political considerations did play a part," the judge said. "That wouldn't be wrongdoing. A new administration comes to town and decides to take a look at a program . . . There's nothing dirty about the word politics. Politics is government."

Gesell ruled that a claim of executive privilege by the president is presumed to be valid and that Zavala had failed to demonstrate sufficient reason to deny the claim.

A trial on Zavala's main suit seeking release of the $855,000 grant is scheduled for May 2.