The Alexandria Bar Association last night endorsed veteran trial attorney Albert H. Grenadier for an Alexandria judgeship, rejecting the controversial candidacy of former Virginia House majority leader James M. Thomson.

In the jammed Alexandria City Council chambers, 253 lawyers went through two ballots before casting 140 votes for Grenadier, a 52-year-old attorney who has had a general practice in Alexandria since 1951.

Thomson, 52, who received 113 votes in the deciding ballot, left immediately without speaking to reporters, leaving unanswered the question of whether he might pursur the judgeship on his own.

Earlier, Thomson said he was angered by a procedural vote in which the bar members decided to select a single nominee instead of three names as provided in rules drawn up last spring by a bar committee headed by Thomson.

Although Thomson had pledged to abide by the bar association's vote, he said yesterday he had changed his mind. "Obviously the rules of the game have changed, so obviously I've changed," he told reporters.

The vacancy was created when Chief Circuit Court Judge Franklin P. Backus announced he would retire Feb. 1 from the $42,500-a-year position.

Thomson's candidacy was opposed publicly by an informal coalition of feminists and the local chapters of the National Association for the Advancement of Colored People and the American Civil Liberties Union. A lobbyist for Virginians for the Equal Rights Amendment said after yesterday's vote she thought that her goup and other Grenadier supporters could now persuade the General Assembly to approve Grenadier for the post.

The bar association's endorsement traditionally has been crucial to judgeship appointments by the General Assembly, where Thomson, a 22-year veteran legislator before his defeat a year ago, has maintained political ties with the Democratic majority.

Judges in Virginia are nominated in a caucus of the Democratic Party, and then elected by the overwhelmingly Democratic legislature.

Del. Richard R. G. Hobson, the senior House member from Alexandria, will carry the bar association's endorsement of Grenadier to the caucus this month.

"The bar association's endorsement has historically been very persuasive on the legislators," Hobson said last night. He said the most important factor, however, is the endorsement of the Democratic Alexandria House delegation, which includes Hobson and Del. Elise B. Heinz.

Hobson said he will decide whether to endorse Grenadier or some other candidate when he receives the report of a 13-member advisory committee today. The committee, made up of Alexandrians appointed by Hobson, was reported last night by one Alexandria attorney to favor Grenadier but also to have said Thomson and the other lawyer were acceptable.

Grenadier, dressed last night in a conservative gray suit and vest, said he was "grateful" for the endorsement of the bar association and refused to predict what impact the recommendation will have on the General Assembly.

Grenadier, when told that Thomson migh still seek the judgeship, said, "I would not have gone in the backdoor."

Four candidates sought the endorsement of the bar association, including Alexandria lawyers Terrence A. Sidley and James Woolls.

On the first ballot Woolls did not receive the necessary 10 percent of the vote, and Sidley, who got 63 votes, chose to give his votes to Grenadier.

Ballots were then distributed again to the attorneys who clogged the City Hall room and spilled over into hallways.

After the announcement that he had failed to gain the bar association's endorsement, Thomson, who has been a strong opponent of the proposed Equal Rights Amendment to the U.S. Constitution, said that he had no comment on the vote and that "I may have something to say tomorrow."

Alexandria lawyer Marvin Miller, who opposed Thomson's candidacy, said last night's vote, "makes the bar responsive to the people of Alexandria.

"What we've done is make a big change in the way things are done in Alexandria. We've made a change in the old boy, old line school, a change that wouldn't have been possible three years ago."