Mahrez, 25, has been in stunning form for the surprise Premier League leaders this season, scoring 14 goals in 25 appearances.
His performances have reportedly attracted the interest of several top European clubs, and Ranieri says he will not stand in the way of any player who wants to leave.
"We want to keep all our players. We believe in them," the Italian said. "But if a player comes to me and says, ‘Boss, I want to go there because it’s my ambition’, I’ll say, ‘Go and enjoy and have good luck’.
"I want only players who are happy to stay here. Sooner or later we will grow as a club and be a very good team but, of course, not like Barcelona or Real Madrid."
RUMOURS | Real Madrid plan Rakitic raid?
However, Ranieri has warned Mahrez that he must maintain his current level of performance if he is to earn a headline-grabbing summer move.
"If I am Riyad I say to myself, ‘There are a lot of teams who want me, so I have to show more if I want to go there’," he added.
"He must think, ‘I have to show my best, because if I do then maybe they want to buy me’.
"Of course if we got Champions League football, it makes it easier to keep him and for that reason the next five matches are very important – they could prove to be key."
Leicester host Norwich City on Saturday as they look to maintain their lead atop the standings.