District of Columbia and Fairfax County officials, who have feuded over security measures at the city-run Lorton prison complex in southern Fairfax County, agreed yesterday to appoint a joint task force to recommend ways to reduce future escapes by prisoners there.

The task force was announced yesterday at the District Building by Mayor Marion Barry and Fairfax County Supervisor Sandra L. Duckworth, following a 1 1/2-hour meeting between city and Fairfax County officials in Barry's office.

Duckworth, who bitterly complained a week ago that the mayor had refused repeated requests by county officials for a meeting about Lorton, yesterday wore a corsage presented to her by Barry and held his hand during a press conference outside his office.

"It's been a long time in coming, but communications have been improved," said Duckworth, a Democrat whose Mount Vernon District includes Lorton.

The mayor added: "We are all concerned about the same thing--safety at Lorton. We don't want anybody to escape."

Fairfax County officials were up in arms last summer over several prisoner escapes and complained that Lorton officials were slow in notifying Fairfax police about escapes and sounding an alarm to warn residents.

Barry acknowledged yesterday that security at Lorton remains a problem, but insisted that conditions are far better there than in most state prisons throughout the country.

"You have some of the most hardened criminals in society there . . . yet some people are surprised that they're trying to escape," he said.

There have been eight reported escapes from Lorton since Barry took office in 1979, according to the D.C. Department of Corrections, including four escapes in 1981 and four in 1982.

That incidence of escapes is reduced greatly from that of the early 1970s, when as many as 29 were reported in a single year, according to a spokesman for the corrections department. By the mid-1970s, the city had reduced sharply the number of escapes by enlarging the prison's staff and installing double fences, electronic surveillance equipment and high-intensity lighting. Between 1977 and 1980, there were no reported escapes, the spokesman said.

Fairfax County officials became alarmed last summer when four escapes occurred within two weeks. County police said they did not learn of an escape on Aug. 1 until a nearby resident telephoned them after seeing a man crawl out of a drainage ditch and don a jogging suit.

The task force created yesterday will consider ways to improve security at the prison and will submit a report within 90 days, Barry said. Task force members include City Administrator Elijah B. Rogers; James Palmer, acting director of the D.C. Department of Corrections; Fairfax County Executive J. Hamilton Lambert and Deputy County Executive Richard King.

Barry said he also intends to escort Duckworth on a tour of the prison complex, which currently houses 2,841 inmates.