Williams, a six-times winner at Flushing Meadows, has had an injury-marred season and limped out of her first-round match at Wimbledon in tears due to the leg injury.
The 39-year-old, who has been on the hunt for an elusive 24th major, skipped the Olympics in Tokyo and also opted out of the Cincinnati Masters, a tune-up event to the U.S. Open.
"After careful consideration and following the advice of my doctors and medical team, I have decided to withdraw from the U.S. Open to allow my body to heal completely from a torn hamstring," Williams wrote in a statement on Instagram.
"New York is one of the most exciting cities in the world and one of my favourite places to play -- I'll miss seeing the fans but will be cheering everyone from afar."
Williams is the latest big name to pull out of the tournament after reigning men's champion Dominic Thiem and four-times winner Rafa Nadal ended their 2021 season due to injuries.
The main draw of the U.S. Open gets underway in New York on Monday. (Reporting by Rohith Nair in Bengaluru; editing by Jason Neely and Clare Fallon)

NEW YORK, NY - SEPTEMBER 06: Serena Williams of the United States runs in for a drive volley in her women's singles semi-final match against Anastasija Sevastova of Latvia on Day Eleven of the 2018 US Open at the USTA Billie Jean King National Tennis Center on September 6, 2018 in the Flushing neighborhood of the Queens borough of New York City. (Photo by Julian Finney/Getty Images)