David Stern -- Hall of Fame ex-NBA Commissioner -- has died 3 weeks after suffering a brain hemorrhage.

The NBA says Stern passed away Wednesday afternoon with his wife, Dianne, and their family at his bedside.

As we reported ... Stern was in serious condition after undergoing emergency brain surgery to address the sudden hemorrhage he suffered at a Manhattan restaurant on December 12. Sadly, he was unable to make a recovery.

David took over as commissioner of the NBA in 1984 and ushered incredible growth in the league over his 30-year tenure. Of course, he was in charge during the heyday of Bird, Magic and Michael ... and helped the NBA become the global juggernaut it is today.

He also famously implemented the NBA's dress code which required players to wear business casual attire to games, and launched the WNBA.

Stern was inducted into the Naismith Memorial Basketball Hall of Fame in 2014.

David was the 4th NBA Commish, and current commissioner Adam Silver was his protege. Silver calls him "a mentor and one of my dearest friends," and says he's "not only one of the greatest sports commissioners of all time but also one of the most influential business leaders of his generation."

He was 77.