Doubts over Ancelotti’s future at the club have arisen after Tuesday’s 4-3 home defeat to Schalke in the Champions League.
The midweek result, which saw holders Real progress to the quarter-final stages with a 5-4 aggregate win, followed a disappointing spell in the Primera Division, which has seen Ancelotti’s team surrender top spot in the standings.
“There’s no doubt that Ancelotti must continue,” Pepe told Spanish radio station Cadena Cope. “He is very good and in a short spell in charge he has given us a lot of joy.”
Ancelotti, 55, replaced Jose Mourinho at the helm of Los Blancos in the summer of 2013.
The former AC Milan, Chelsea and Paris St Germain tactician led the Spanish giants to success in the Champions League and Copa del Rey in his debut season at the Bernabeu stadium.
“I don’t miss Mourinho,” Pepe said. “I can assure you Ancelotti is not soft. He has a grandiose curriculum vitae and he demands a lot.
“We work with more intensity with Ancelotti than we did with Mourinho. Thanks to God that I’ve had a coach like Ancelotti. He has helped me a lot.”
Real had achieved a club record 22-match winning run earlier this season before losing 2-1 to Valencia in January.
Ancelotti’s side host Levante on Sunday looking to halt a three-match winless run in all competitions before facing Barcelona in El Clasico at the Nou Camp on March 22.
Real were held to 1-1 draw by Villarreal before falling 1-0 at Athletic Bilbao on Saturday to drop one point behind new leaders Barcelona.
While results are not ideal, Pepe is confident his team will pull through.
“We are really determined to come out of this situation because we are the same team of two months ago that everyone thought was unbeatable,” the Portugal international said. “It’s painful to be booed at the Bernabeu stadium but our fans have every right to do so.
“We have to admit that we are not playing well and that at Schalke we lacked attitude.
“We run a lot but we are not playing like a team.”
Looking ahead to the clash at Barcelona, Pepe does not rule out his team springing a surprise.
“Barca are favourites because they are playing at home and they are in better shape,” he said. “But in El Clasico anything can happen.
“We are not at our best but we have quality and we have not forgotten how to play football.”