Bill Foster, the first basketball coach in NCAA history to win more than 20 games a season at four Division I schools, resigned yesterday after six seasons at South Carolina.

The announcement, which came on the heels of last weekend's 100-59 defeat by Memphis State in the first round of the Metro Conference tournament, was no surprise and ended a month of speculation about his future.

Foster, 55, whose team lost its last eight games in a 12-16 season, had two years remaining on his contract. The school said the financial commitment will be honored.

The coach's best season at South Carolina was 1982-83, when the Gamecocks had a 22-9 record, were invited to the National Invitation Tournament and won their first two games. Foster missed much of that season after suffering a heart attack, and assistant Steve Steinwedel directed the team in his absence . . .

Duke (32-2) was a near-unanimous No. 1 selection by a nationwide panel of 64 sportswriters and broadcasters in the Associated Press' final basketball poll, receiving 63 first-place votes and 1,279 points. Kansas (31-3) received the only other first-place vote and 1,213 points.

Kentucky, the Southeastern Conference champion, was ranked third, followed by St. John's, the champion of the Big East. Georgetown was ranked 13th and Navy 17th in the final poll going into the NCAA tournament.