That is not why God denied him entrance into the promised land. Deu. 32.51 – “For you both broke faith with Me among the Israelite people, at the Waters of Meribath-kadesh in the wilderness of Zin, by failing to uphold My sanctity among the Isralite people.”
**This subject of Moses not entering into the promised land is well described in the Quran chapter 5, verses 19 onward: Please read:
[5:19] O People of the Book! there indeed has come to you Our Messenger, after a break in the series of Messengers, who makes things clear to you lest you should say, ‘There has come to us no bearer of glad tidings and no Warner.’ So a bearer of glad tidings and a warner has indeed come to you. And Allah has power over all things.
[5:20] And remember when Moses said to his people, 'O my people, call to mind Allah’s favour upon you when He raised Prophets among you and made you kings, and gave you what He gave not to any other among the peoples;
[5:21] ‘O my people, enter the Holy Land which Allah has ordained for you and do not turn back, for then you will return as losers.’
[5:22] They said, ‘O Moses, there is in that land an unruly and powerful people, and we shall not enter it until they go forth from it, but if they go forth from it, then we will enter it.’
[5:23] Thereupon two men from among those who feared their Lord, on whom Allah has conferred His special favour, said ‘Enter the gate advancing against them; when once you have entered it, then surely you will be victorious. And put your trust in Allah, if you are believers.’
[5:24] They said, ‘O Moses, we will never enter it, so long as they are in it. So go thou and thy Lord and fight, and here we sit.’
[5:25] He said, ‘My Lord, I have no control except over myself and my brother, therefore distinguish Thou between us and the rebellious people.’
[5:26] God said: 'Verily it shall be forbidden to them for forty years; in distraction shall they wander through the land. So grieve not over the rebellious people.**
The same story is mentioned in the OT too. The Jews failed to advance into the promised land for fear of the Palestinians. Moses is calling his people “Rebellious people”. And Moses told Allah that he had no hold on his people who had refused the orders.
So Allah forbade, not Moses a.s., but the Israelis generation from entering Palestine. Moses had to be with them. He could not go alone. He could not enter alone. So that is the mistake of the people, not Moses a.s.