William H. Simons, president of the Washington Teachers Union for its entire 19-year history, kept his post in yesterday's union election by defeating challenger James D. Ricks by 204 votes.

Simons outpolled Ricks, a Ballou High School teacher, 1,411 to 1,207, as Simons' entire slate swept to victory in the mail-in vote, winning all 22 of the union's elective offices.

Ricks had defeated Simons by four votes last March in an election that later was thrown out by U.S. District Court Judge Aubrey E. Robinson Jr. The election was thrown out, in part, because of evidence brought by Ricks that showed that votes had been tallied from people who claimed to have never received ballots and never voted.

The March election had been mandated because Robinson had thrown out the union's 1981 election on the ground that it was not conducted by secret ballot as required by federal law.

Late last night, Simons was surrounded by emphatic supporters at the Skyline Inn. "I told you don't sing any sad songs for me," Simons told the crowd. "The curtain had not been drawn and the fat lady had not sung."

Contacted at his Southeast Washington home, Ricks said, "You're in and you're out. It's like a baseball game."

Ricks said several supporters tried to challenge several ballots last night on the grounds that the voters were not proved to be in good standing with union dues. To be eligible to vote, a member had to be no more than 90 days in arrears on dues.

But Simons praised supporters who "left no stone unturned" in campaigning since his surprising defeat last March.

Luther Shelton, a Beers Elementary School teacher and a slate mate of Simons, won the union's general vice presidency over Ricks' slate member Jeanette Feely by a vote of 1,368 to 1,202. Feely had beaten Shelton in the March election that subsequently was overturned.

Also running for union president were Jimmie D. Jackson, who received 110 votes, and William I. Stewart, who received one vote.

Mac Syphax, a Labor Department spokesman who helped monitor the election, said, "the mechanics went smoothly," but both Simons and Ricks said they expected the election to be challenged.