The event falls between the British and San Marino Grands Prix and will be the three-time MotoGP race winner's debut in international car racing.
It arose from an invitation from KTM AG board member Hubert Trunkenpolz, who will be one of Oliveira's True Racing team-mates at the Circuit de Barcelona-Catalunya.
“I am super excited and also incredibly proud to get the chance to be a part of this race,” said the Portuguese rider.
“Motorcycle racing has been part of almost my entire life, but my career began in the Portuguese karting championship, which is why I am so keen to race four wheels.
“There was absolutely no hesitation on my part when Mr Trunkenpolz invited me.”
Coincidentally, Barcelona-Catalunya is where Oliveira won in MotoGP in June.
He will partner KTM works driver Reinhard Kofler, as well as Peter Kox and Ferdinand Stuck, in one of the two True Racing X-Bow GTXs when he returns to the circuit to race on four wheels.
“I look forward to learning as much as I can from them,” added the 2018 Moto2 world championship runner-up.
“Competition is obviously a substantial part of racing, but I think my top priority will be to find my feet and have some fun.”
The 2021 MotoGP season continues this weekend with the British Grand Prix, while the 24H Barcelona, Round 5 of the Creventic-run 24H Series, takes place on September 3-5.