Underdog Democrat Wayne Dowdy narrowly defeated Republican Liles Williams in a special election runoff today for the 4th Congressional District seat vacated by former representative John C. Hinson (R-Miss.) after his arrest on a morals charge.

With all precincts counted in unofficial returns, Dowdy, who showed solid strength in rural counties, had 55,512 votes and Williams 54,486.

Dowdy told several hundred cheering supporters at his victory party, "On our budget, we cannot afford a landslide."

Williams, who campaigned as a supporter of President Reagan, declined to concede defeat.

In Washington, Rep. Tony Coelho (D-Calif.), chairman of the Democratic Congressional Campaign Committee, said Dowdy's victory represents a repudiation of "the idea of a Solid South for Ronald Reagan."

Dowdy, 37, first-term mayor of McComb, was second in the first round of voting June 23 with 23 percent of the vote, but Gov. William F. Winter and other Democratic officials backed him in the runoff after other Democrats were eliminated in the eight-way race.

The runoff effort produced about 110,000 votes a 21,000-vote increase over the turnout in june.

Williams, 45, a Jackson business executive, was favored after taking 45 percent of the votes two weeks ago. Republicans had pumped more than $300,000 into the campaign, and Reagan made a personal call to Williams on election eve in a move to get the GOP candiate more leverage.

Hinson's seat has been open since he resigned and pleaded no contest in February to a misdeameanor charge of attempted oral sodomy.

Hinson, 39, was hospitalized in Washington for more than two months, and last month was given a 30-day supsended jail sentence and placed on a year's probation with minimum supervision.

Dowdy wooed black voters by favoring an extension of the Voting Rights Act, and accused Williams of having heavy backing from oil interests.

Calling himself a conservative on fiscal matters and a moderate on social issues, he said, "I'm running against the White House, the United States Chamber of Commerce and every oil company in the world."