BRIDGEPORT, CONN., JULY 21 -- Democrat Christine M. Niedermeier and Republican Christopher Shays won party nominations today to the seat left vacant by the death of Rep. Stewart B. McKinney (R).

Niedermeier defeated state Sen. Margaret E. Morton of Bridgeport and Stamford banker Michael Morgan in the campaign to advance to the Aug. 18 special election to fill the 4th District seat, unofficial results showed.

Shays emerged the winner from a four-way Republican field that included Darien developer Frank D. Rich Jr., Greenwich businessman John T. Becker and Fairfield state Rep. John G. Metsopoulos.

Unofficial results showed Shays with 10,280 votes to 7,475 for Becker, 6,851 for Rich and 2,921 for Metsopoulos.

On the Democratic side, Niedermeier had 13,645 votes to 7,198 for Morton and 4,928 for Morgan.

Niedermeier, 36, of Fairfield, served four terms in the Connecticut House, leaving in 1986 to challenge McKinney last November. She lost to the popular congressman by about 10,000 votes, his closest race in years.

Shays, 41, of Stamford, is a seven-term state representative. He drew attention in 1985 when he was sent to jail on contempt of court charges for refusing to leave a courtroom witness stand because he wanted to testify in disciplinary proceedings against a Hartford lawyer.

McKinney was serving his ninth consecutive term when he died in May from an AIDS-related infection. He was the first member of Congress to die as the result of acquired immune deficiency syndrome.

The 4th District includes nine towns in lower Fairfield County and includes affluent New York City suburbs and the cities of Bridgeport, Stamford and Norwalk.

In addition to the major party contenders, the special election will include Stamford plumber Nicholas J. Tarzia, who petitioned himself onto the ballot as candidate of the "War Against AIDS Party."

The Republican primary was the first since the GOP won a court fight to open its primaries to unaffiliated voters.

About 73,000 unaffiliated voters were eligible to join the district's 91,700 Republicans in the GOP primary. About 105,000 Democrats were eligible to vote in that party's primary.