Yishmael was certainly not a Tzaddik in the true sense of the word. This is precisely the reason why Sarah and Avraham sent him away.
So in the dialogue between Hashem and the (prosecuting) angels: why does Hashem say that Yishmael was a tzaddik?
You need to look at the context of the dialogue.
Yishmael was going to die of thirst. Hashem lets the angels know that He is going to miraculously reveal a well of water to save Yishmael.
The angels in turn cry out in disbelief: What?? Yishmael's descendants will kill Yitchak's with thirst, and now You - Hashem - make a miracle to save him from thirst??
To this Hashem answers the angels:
What is he now, righteous or wicked?” They replied, “Righteous.” He
said to them, “According to his present deeds I judge him” (Gen.
Rabbah 53:14).
So clearly Hashem is answering the claim of the angels that Yishmael cannot be held guilty of killing Jews by thirst... so regarding that claim - he is innocent (== "righteous")
[see Tanya Ch. 1 - there the Alter Rebbe of Lubavitch defines 'Tzaddik' according to its true meaning, but then explains that many times in Chazal the word Tzaddik is loosely used as a 'borrowed name' in order to emphasize 'rightousness' in a particular detail.
והא דאמרי' בעלמא דמחצ' על מחצה מקרי בינוני ורוב זכיות מקרי צדיק הוא שם
המושאל לענין שכר ועונש לפי שנדון אחר רובו ומקרי צדיק בדינו מאחר שזוכה
בדין אבל לענין אמיתת שם התואר והמעלה של מעלת ומדרגות חלוקות צדיקים
ובינונים ארז"ל צדיקים יצ"ט שופטן שנא' ולבי חלל בקרבי שאין לו יצה"ר כי
הרגו בתענית
]