It will be the 22nd career match-up between the two long-time rivals, who somehow have avoided each other at the U.S. Open throughout their long careers.
Twelve months after losing the final to Naomi Osaka, Williams will have to hit the ground running in her quest for a 24th Grand Slam title.
Williams has won the U.S. Open six times, while Sharapova's lone title was in 2006.
Sharapova beat Williams twice in 2004, but has not prevailed since, not counting a walkover in the 2018 French Open, where the American pulled out with an injury.
If Williams, the eighth seed, beats Sharapova and subsequent opponents, she could meet top seed Osaka again in the final, as the pair are on opposite sides of the draw.
Wimbledon finalists Novak Djokovic and Roger Federer are on a semi-final collision course after they were placed in the same half of the draw.
Top seed Djokovic, who saved two match points in the All England Club final to deny Federer a record ninth title at the grasscourt championships, will start his campaign against 76th-ranked Roberto Carballes Baena before facing a potential second-round showdown against American Sam Querrey.
Third seed Federer, who won the last of his five Flushing Meadows trophies in 2008, will open against a qualifier as he chases a 21st Grand Slam title.
Second seed Rafael Nadal, who was beaten by Federer in the Wimbledon semi-finals, will play Australian John Millman in the first round of the hardcourt major which starts on Monday. Millman reached the U.S. Open quarter-finals last year after knocking out Federer in the last 16.
The Spaniard, three-times a champion in New York, could run into 2014 champion Marin Cilic in the fourth round.