The five Democratic candidates for mayor clashed last night in the final televised debate of the primary campaign, while a new poll found the race tightening, with John Ray holding a slight lead and Sharon Pratt Dixon showing some momentum three days before the election.

WJLA-TV (Channel 7) reported last night the findings of a voter survey showing Ray leading the other candidates with 24 percent support, followed by Dixon and Charlene Drew Jarvis with 17 percent each, David A. Clarke with 9 percent, Walter E. Fauntroy with 8 percent and 26 percent of the voters undecided or not stating a preference.

The poll of 600 registered D.C. voters had a margin of error of plus or minus 4 percentage points and was conducted by KCR Communications Research, a polling firm based in Newton, Mass.

The survey was taken over a three-day period this week, after Dixon had won the editorial endorsement of The Washington Post -- a development in the campaign that Ray and others have said gave Dixon an important boost in her first bid for elective office.

According to the WJLA poll, Ray maintains a "significant" lead among male voters, runs evenly with Jarvis and Dixon among women and performs equally well among black and white voters. Dixon enjoys the strongest support among white voters, while Ray has the highest favorable ratings among undecided primary voters, the poll found.

A Washington Post poll conducted Aug. 21 to 27 showed Ray leading with 33 percent, followed by Jarvis with 17 percent, Dixon and Fauntroy with 10 percent each and Clarke with 9 percent.

The five candidates spent much of yesterday searching for senior citizen votes, raising funds for a last-minute flurry of radio and television commercials and preparing for a televised debate last night on WETA-TV (Channel 26).

At one point in the WETA forum, which revolved around hypothetical questions posed to the candidates, Ray said city police officers should be allowed to go to the "narrow edge of the law" to rid neighborhoods of open-air drug markets.

Clarke took a somewhat different approach, saying some residents had banded together successfully in neighborhood watch programs. "Too often, we say we're going to choose between the police and the community," Clarke said. "That does not need to be the case . . . . The community can be in their own patrol."

Dixon disputed that view, saying that citizens too often take on duties better left to police. "I'm very tired of the city asking senior citizens to go out there in orange hats and face down drug dealers. I think that's the responsibility of the police," she said.

At the end of the forum, when the candidates were allowed to ask each other questions, Jarvis and Ray were criticized for their support of 1985 legislation that would have phased out rent control, and Ray and Jarvis got into a testy exchange about their support for women's issues.

After Jarvis took him to task for his "insensitivity" to such issues, Ray snapped back, "I was there long before you were."

Four of the five Democrats -- Clarke, Fauntroy, Jarvis and Ray -- met yesterday with at least one group of seniors, while Dixon won the endorsement of a group of black firefighters.

"She represents the new breed of politician we need in this city," said Nathan Queen, president of the Progressive Firefighters Fraternal Association, a national organization with relatively few members here.

The city's largest firefighters union previously endorsed Ray, an at-large member of the D.C. Council, in Tuesday's primary election.

Senior citizens, a potentially important bloc of votes in the election, have been heavily courted all week by the candidates, who again made the rounds of nursing homes and senior centers yesterday.

Clarke, chairman of the D.C. Council, met with residents of Carver Terrace in Northeast Washington and Claridge Towers in Northwest, while Fauntroy, the District's delegate to Congress, visited the Presbyterian Home in Northwest and lunched with seniors at Garfield Terrace in Southeast.

Jarvis, who represents Ward 4 on the D.C. Council, greeted seniors at a Safeway on Connecticut Avenue NW before visiting the Roosevelt Senior Center on 16th Street NW. Ray hosted a senior citizen luncheon at his campaign office in downtown Washington.