UFC officials announced the 185-pound match Friday during a Summer Kickoff news conference. The televised Fight Night will take place at Nassau Coliseum in Uniondale, New York.
Weidman, a Long Island native, is coming off a controversial loss to Gegard Mousasi at UFC 210 last month in Buffalo, New York. It was the former titleholder's third defeat in a row.
Weidman (13-3) lost the fight via TKO after absorbing a knee that referee Dan Miragliotta initially ruled illegal. After replay confirmed the blow was legal, Weidman was declared the loser. He filed an appeal of the result to the New York State Athletic Commission; it is still pending.
Gastelum (13-2) is serving a 90-day suspension for a positive marijuana test in March. He knocked out Vitor Belfort in stunning fashion in Fortaleza, Brazil, but the win was later changed to a no-contest due to the failed drug test.
A former welterweight, Gastelum has looked spectacular at 185 pounds. In addition to his performance against Belfort, he holds recent knockouts wins over Nate Marquardt and Tim Kennedy at the weight class.