Brazil have been without a manager since Tite left after the World Cup and various reports claim Ancelotti is their top target.
Madrid forward Vinicius recently said he "believes" his club coach wants to take the Selecao job and Ancelotti is flattered by the interest.
"The reality is that the Brazilian national team wants me; I love that, it's exciting," Ancelotti told a news conference before Madrid's game against Real Valladolid.
"From there, you have to respect the contract you have, which is a contract that I want to fulfil."
Ancelotti, 63, has a deal with Madrid until 2024. He returned to the club for a second spell in charge in 2022 and led Los Blancos to a LaLiga and Champions League double last season.
This year, Madrid are 12 points behind leaders Barcelona in LaLiga but remain in the Champions League and the Copa del Rey.
His future, therefore, is expected to be linked to how Madrid do in those two cup competitions, although he insists he wants to stay at the Santiago Bernabeu.
"Everything is quite clear, I'll stay here as long as Madrid allow me to stay here," he added.
"I feel a lot of affection from the president [Florentino Perez], the fans, the players, the atmosphere is very calm around me ... we now have two and a half months to try to win two trophies."
Pressed further on the Brazil interest, Ancelotti said he did not personally know Ednaldo Rodrigues, the president of the Brazilian Football Federation, but that he would be "delighted to speak to talk with him" if he wanted to.