how can we say that Plato is an idealist inspite of the fact that he opposes poetry that based on ideals?
We can say that Plato isidealistic, because he believes that we can have a great society through reason and philosophy. In fact, he is unswerving in this belief. Thisis part of the reason why he write so much! He also believes we can come to know ultimate things (the forms) through sustain dialectics and thereby create a utopian society.
With that said he is not blindly idealistic. He knows that certain things must be done to safeguard people and cause them to live better lives based on philosophy. For this reason he banishes the poets. He believes that poets do not know that they are talking about as they are non-philosophers. In addition, he believes that they cause people to follow bad example through imitation. In a word, we can say that Plato is idealistic but not blindly so.
In view of this what is really important is our definition of idealism. If our definition of idealism contians practical steps to get to the ideal, then Plato fits in very well.