Sforno implies that Hashem was going to examine them individually.
אם אמצא בסדום עתה כשאנסה אותם במלאכי' ששלחתי אם אמצא בסדום נ' צדיקים שימחו ברשעים בסדום שהיא ראש לשאר הערים כאמרו סדום ובנותיה ובה יקבצו נדיבי העם מכל שאר הכרכים אשר בככר:
אם אמצא בסדום - now that I will examine them individually, having sent My angels, if I find 50 righteous men of the type that will protest and try to stop the wickedness of the remainder of the people in Sodom, the leading city of the valley (sefaria translation)
So it would seem Hashem wanted to individually examine them and only then if he found fitting people would he save them. I imagine, in much the same way we have Rosh Hashanah & Yom Kippur, and you can argue why do we need it if Hashem knows what our year will be like, He still takes the time to review our 'personal account' and that is possibly how to understand it in the case of Sedom.
Alternatively the Malbim offers another suggestion:
ויאמר ה'. הודה לו שאם אמצא בסדום חמשים צדיקים, אפילו שלא יהיו צדיקים גמורים רק יהיו צדיקים בתוך העיר בערך אנשי סדום ישא לכל המקוםשכולל לכל ערי הככר:
i.e. Even if they were not complete tzaddikim but had some semblance of righteousness then he would save them.