Rashi comments that Moshe changed his name and davened that Hashem should save Yehoshua from the עצת המרגלים.
This is very difficult...
1. We see clearly from Rashi that Moshe knew that the Meraglim would sin, that is why he davened that Yehoshua would not be caught up in it. If so, why did he send them at all? ...
2. Why daven only for Yehoshua?
It is an excellent question.
I would suggest the following answer. Yes, Moshe knew that they would sin, but had to send them anyway. And the difference is between those who are meizidim and those who would get caught up with them in the plot. There are actually multiple Rashis in play here.
We have the one about changing Yehoshua's name:
|16. These are the names of the men Moses sent to scout the Land, and Moses called Hoshea the son of Nun, Joshua.||טז. אֵלֶּה שְׁמוֹת הָאֲנָשִׁים אֲשֶׁר שָׁלַח מֹשֶׁה לָתוּר אֶת הָאָרֶץ וַיִּקְרָא מֹשֶׁה לְהוֹשֵׁעַ בִּן נוּן יְהוֹשֻׁעַ:|
|And Moses called Hoshea…: He prayed on his behalf,“May God save you from the counsel of the spies.” [The name יְהוֹשֻׁעַ is a compounded form of יוֹשִׁיע ֲיָהּ, May God save you.]- [Sotah 34b]||ויקרא משה להושע וגו': התפלל עליו יה יושיעך מעצת מרגלים:|
We have the one on Shelach Lecha:
|Send for yourself: According to your own understanding. I am not commanding you, but if you wish, you may send. Since the Israelites had come [to Moses] and said, “Let us send men ahead of us,” as it says, “All of you approached me…” (Deut. 1:22), Moses took counsel with the Shechinah . He [God] said, “I told them that it is good, as it says, ‘I will bring you up from the affliction of Egypt…’ (Exod. 3:17). By their lives! Now I will give them the opportunity to err through the words of the spies, so that they will not inherit it.” - [Midrash Tanchuma 5]||שלח לך: לדעתך, אני איני מצוה לך, אם תרצה שלח, לפי שבאו ישראל ואמרו (דברים א, כב) נשלחה אנשים לפנינו, כמה שנאמר (שם) ותקרבון אלי כלכם וגו', ומשה נמלך בשכינה. אמר אני אמרתי להם שהיא טובה, שנאמר (שמות ג, יז) אעלה אתכם מעני מצרים וגו', חייהם שאני נותן להם מקום לטעות בדברי המרגלים למען לא יירשוה:|
Thus, indeed, Hashem is not only giving him a choice in the matter (as per the beginning of Rashi), but (assuming Hashem is not speaking to Himself at the end) is telling him up front that there will be a problem, and that this will be an opportunity for the Israelites to err, by the listening to the evil report of the spies. Whatever question exists, it exists even beforehand within this single Rashi, such that we need not go as far as the changing of Yehoshua's name.
It could be that Moshe would have faced a rebellion had he not heeded the request of the Israelites. Or maybe Hashem is saying that if Klal Yisrael have the wish, they may send, but it is not on His advice or command. (The intent of the Rashi is after all to harmonize the apparent contradiction with Moshe's rebuke in sefer Devarim.) I can see various different ways of interpreting this Rashi.
What about praying for the other spies who needed it more? Well, another Rashi states (based on that same gemara in Sotah about changing Yehoshua's name):
|They went, and they came: What is meant by“They went”? [It says already that they returned.] To compare their going with their coming. Just as their return was with evil intent, so was their departure [on the journey] with evil intent. — [Sotah 35a]||וילכו ויבואו: מהו וילכו, להקיש הליכתן לביאתן, מה ביאתן בעצה רעה, אף הליכתן בעצה רעה:|
Their intent at the start was already evil, such that they had already decided. The only two who had not decided were Kalev and Yehoshua. Which is why Moshe interceded on behalf of Yehoshua.