The group will play Aug. 9 at the Illinois Lottery Grandstand Stage.
Megadeth has sold 38 million albums and received 12 Grammy nominations. The group's 15th studio album, Dystopia, was released in 2016.
Other performers scheduled in the grandstand this summer include Pentatonix, Old Dominion, Snoop Dogg, Shinedown and Reba McEntire.
Concert tickets go on sale April 20 via Ticketmaster and on April 22 at the state fairgrounds in Springfield.
The fair runs from Aug. 8 to 18.