DeChambeau, 27, will be replaced by Patrick Reed on the U.S. team.
According to statements released Saturday night by the International Golf Federation and USA Golf, DeChambeau tested positive as part of the final testing protocols before leaving the United States for Japan.
Rahm's positive test was announced by the Spanish Olympic committee. He tested positive for COVID-19 for the second time in two months Sunday.
Rahm will not be replaced on the Spanish team, leaving Adri Arnaus as the country's lone hope in the men's golf event.
"I would have loved to have been the first Spanish Olympic gold medalist in golf," Rahm said in a tweet, "but unfortunately destiny had other plans. This is a great reminder for all of us that we're still in a pandemic, things are not over, and we still need to fight together to get through this the best we can."
The back-to-back announcements came on the second full day of action in Tokyo and put a damper on the golf tournament, which is scheduled to begin Thursday.
"I am deeply disappointed not to be able to compete in the Olympics for Team USA," DeChambeau said in a statement. "Representing my country means the world to me, and it is was a tremendous honor to make this team. I wish Team USA the best of luck next week in Tokyo.
"I will now focus on getting healthy, and I look forward to returning to competition once I am cleared to do so."
DeChambeau earned the last of four qualifying spots because Dustin Johnson elected to not participate.
Reed, 30, who played the 3M Open in Minnesota this weekend, must go through the Olympic testing protocols, which will continue Sunday and Monday. He tied for 11th in the 2016 Olympic tournament in Brazil and would become the first U.S. player to compete in two Olympics.
Patrick Cantlay and Brooks Koepka were the first and second alternates after DeChambeau, with Reed third. In order for Reed to make the team, Cantlay and Koepka would have had to decline their invites.
"These days with how good yardage books are and with how much we have to kind of figure things out on the fly as it is, I expect to go in there and play well and be able to manage the golf course and hit the golf shots," Reed said on Sunday, after shooting a 71 to finish at 6 under for the tournament.
True to his "Captain America" nickname, Reed has long been more enthusiastic about the Summer Games than many of his peers on the tour. He's now the only two-time Olympian on the men's side of the sport, which was reintroduced to the program in 2016. He shot 64 in the final round in Rio de Janeiro and finished 11th.
"It feels like an obligation and a duty of mine to go out and play for our country whenever I can and whenever I get the call. To be able to call myself not just an Olympian but a two-time Olympian is pretty sweet," Reed said.
Both the European Tour and the R&A confirmed Sunday that all players in both fields were required to take a COVID-19 test as a condition of play, regardless of vaccination status or a prior COVID-19 positive result. At The Open, all players also were required to take an exit test. All passed.
This is notable in light of Rahm's status on the PGA Tour. Having tested positive at the Memorial Tournament, he would have been exempt from testing on the PGA Tour. And starting at this week's 3M Open, the tour was scheduled to stop testing altogether. Since April, it has tested only those who were not fully vaccinated.
A country can send up to four players, as long as they are ranked among the top 15 in the world; otherwise, there is a maximum of two players allowed per country.
DeChambeau is ranked sixth in the world; Reed is 13th, but he was ninth following the U.S. Open, the cutoff for Olympic consideration.
"I wish Bryson nothing but the best, and I know how disappointed he is to not be able to compete, and I will do my best to play my best and represent our country," Reed said in a statement prior to the final round of the 3M.
The Associated Press contributed to this report.