John Touchstone, director of the D.C. Department of Public Works, said yesterday that he and a top aide accepted free travel and hotel accommodations for two nights in New York City from a firm that has a city contract to collect unpaid parking tickets.

The 1984 trip occurred four months before the public works department agreed to award a larger, multimillion-dollar parking management contract that ultimately went to the firm, Datacom Systems Corp.

"In hindsight, I think I may not have done the right thing," Touchstone said of his decision to allow Datacom to pay for the trip.

The District's conflict-of-interest law prohibits a city official from soliciting or accepting a gift, favor or hospitality "when it could be reasonably inferred" that the gratuity would influence the official's decisions.

A spokesman for Datacom, which receives an estimated $4 million a year from two D.C. public works contracts, said yesterday that the company made a "dumb mistake" by not first checking with District officials to make sure that paying for the trip by Touchstone and his executive assistant, Marie Timm, was proper. The spokesman said the firm routinely pays the expenses of public officials inspecting its facilities in other cities, but normally does so only after making sure the trips do not violate local conflict-of-interest laws.

Touchstone said he decided to personally reimburse Datacom for his and Timm's trip after a reporter questioned him yesterday about the trip. "My personal integrity is worth more than any trip," Touchstone said. " . . . I don't want anybody to think there is any hint of any impropriety."

He said the trip to inspect Datacom facilities in the New York area did not influence the awarding of the D.C. contract. Touchstone and Datacom officials could not immediately say what the trip's total cost was.

Keith Vance, the D.C. official chiefly responsible for enforcing the District's ethics rules, said yesterday that in general, city officials are prohibited from accepting free travel and expenses from firms holding or seeking city contracts because it creates the appearance of an impropriety. However, Vance said he regarded Touchstone's actions as a "very minor technicality."

Datacom has come under scrutiny recently in Chicago and New York City in the wake of a federal investigation into allegations that one of Datacom's competitors bribed officials in both cities.

New York Mayor Edward Koch ordered a city review on Thursday of parking collection contracts held by Datacom and other firms holding such contracts after the arrest Tuesday of a senior city parking official on a charge of extorting $5,000.

In Chicago this week, a federal grand jury investigating Datacom's competitor subpoenaed records of Datacom, which also has a Chicago contract, according to Datacom's spokesman, who said that Datacom is cooperating with the investigation and had offered to turn over the records voluntarily.

Datacom, a subsidiary of Lockheed Corp., is considered a pioneer in the lucrative and rapidly growing parking collection and management field. One of its principal salesmen has been company executive vice president John Brophy, a former top D.C. parking official.

Brophy, a close friend of City Administrator Thomas Downs, also recruited Ivanhoe Donaldson, Mayor Marion Barry's former chief political adviser and top aide, to be a part-time consultant to Datacom and a member of its board of directors after Donaldson left D.C. government in late 1983.

Donaldson severed his ties with Datacom sometime last summer. Last month, he pleaded guilty in U.S. District Court here to three felony charges relating to his defrauding the District government of more than$190,000 during a three-year period. Donaldson is awaiting sentencing.

Datacom has two parking contracts with the D.C. public works department, including a contract worth an estimated $3.2 million a year for management and computer services, and a $300,000 to $400,000 a year contract to collect overdue parking tickets.

Frederic Caponiti, a top D.C. public works parking official, said that problems with the city's computerized parking ticket record system caused city officials to consider hiring an outside firm. He said that Brophy urged city officials to take advantage of a system Datacom was using successfully in other cities, but that Brophy was not involved when the city entered into formal negotiations on the new contract.

In early 1984, Caponiti said, Datacom sent the city an unsolicited proposal to take over the data processing and certain management functions of the city's parking ticket program.

He said the city sought out many other firms when it issued a formal request for proposals in July 1984. Caponiti said that when Datacom was the only firm to submit a proposal, "it didn't shock us."

"We didn't know of any other firms . . . but we went out to test the marketplace," he said.

City Administrator Downs in the fall of 1984 signed a letter tentatively awarding Datacom the contract.

The city and Datacom signed the contract on March 25, 1985. Touchstone, as public works director, signed the contract for the city.