Second seed Rafael Nadal, who was beaten by Federer in the Wimbledon semi-finals, will play Australian John Millman in the first round.
Wimbledon finalists Novak Djokovic and Roger Federer are on a semi-final collision course at the U.S. Open after they were placed in the same half of the draw on Thursday.
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.