Loeb will drive a specially prepared Citroen DS3 XL (X for X Games, L for Loeb), built by rallycross specialists Hansen Motorsport, at the Los Angeles event.
As well as taking on fellow Red Bull driver Travis Pastrana, Loeb will face his old WRC adversary Marcus Gronholm.
Loeb said: "I love racing and I'm always interested in trying out new categories.
"A week after the New Zealand Rally has finished, I'll be in Los Angeles to take up the challenge set for me by Travis.
"Rallycross here in Europe provides some very spectacular racing, but the American version seems to be even more extreme.
So, I didn't need to be asked twice when the opportunity arose to race against drivers like Marcus Gronholm in a 545bhp Citroen DS3."
Citroen Racing director Yves Matton added: "We were fully aware of the importance that Red Bull attaches to the X Games Los Angeles when we agreed to take part.
"Once we had actually committed to the project, we prepared for the event with the utmost seriousness.
"As it's a one-off event for us, we don't have to worry about managing our position in the championship.
"There's only one race and we are really determined to try and win it. It won't be easy because it will all be new to us, compared with our rivals who are used to this type of racing, but we'll be fighting every inch of the way."
X Games starts on Friday June 29.