The Qur'an teaches us to look at the civilizations that came before us, consider their rise and fall, and take lessons from that so we make the best decisions in our own lives and societies. We should also look at previous civilizations to be humble: we should not assume that just because our society is at an apex, it must last forever. If our society is prosperous, we should thank Allah for that and not assume it is all under our control, since those people who started to attribute blessings to themselves instead of Allah soon fell.
The Qur'an and hadith give a sense that there are some metaphysical laws underpinning civilizations. Positive spiritual and ethical practices of societies lead them to flourish, whereas negative spiritual and ethical practices lead them to decay or destruction. This is part and parcel of natural law and is often connected to natural causes but is also part of divine justice.
Some Muslims see the process of history as a gradual unfolding and en route to an ultimate victory of tawhid - that is, a meaningful process of history - although others may not agree with that.
The main criticisms in the Qur'an of pre-Islamic societies are of idolatry, superstition, tribalism, and depotism. In some cases, flagrant violations led Allah to rain down destruction on some places, as in the Old Testament. In other cases, they just led to the decline of the civilization.
Pre-Islamic Abrahamic monotheists are also sometimes criticized for deviation, self-glorification, and so forth.
Individual people in ancient societies are presented in accordance with their acts. For instance, the husband of Zulaykha in Egypt is presented as neutral, whereas Firawn is presented as evil. The Queen of Sheba is overall presented as a good ruler but as starting out with an incorrect theology due to worshipping the sun. There are also some specific criticisms of specific places/times such as the people of Lut.
Mesopotamia was a large region with many peoples and dynasties, so one cannot give a single view for the whole civilizational phenomenon. Similarly, ancient Egypt had a long reign of dominance and so one cannot make sweeping views about everything. This is apart from the obvious fact that both Mesopotamia and ancient Egypt contributed to the the development of later civilizations and so we retain some of their legacies, such as some ideas or technologies.
Babylon gets a bit of a bad rap in the Qur'an due to the Harut and Marut situation, and also the story of Ibrahim (A). Ancient Egypt is also associated with magic. But neither place is discussed extensively. This is different from the Biblical tradition, in which Babylon is personified and condemned.
On the other hand, Shi'i hadith speak of the sanctity of Karbala from ancient times, and Karbala is in Mesopotamia. There are also Shi'i hadith speaking of Adam being created from the clay of the Euphrates. So there is a sense of a portrayal of this region as part of the cradle of civilization.
Muslims have had various views about the ancient heritages. Some Muslims found benefit in reading ancient philosophical texts like those from Greece or in wisdom from things such as the Code of Hammurabi or traditional Chinese medicine. Other Muslims opposed ancient things because they belong to pre-Islamic times and civilizations.
Insofar as the hadith says to seek knowledge even from China, and China obviously was not a Muslim-majority or Abrahamic civilization, one can assume that Islam does not have an objection to seeking beneficial knowledge from ancient civilizations.
Today, some Muslims are very focused making a full break from the ancient past and fear anything from the ancient times as bid'ah or shirk. So they reject anything ancient, on the grounds that it is pre-Islamic, although ancient things - like modern things - can sometimes have wisdom and sometimes have error. Other Muslims have an interest in studying the past, such as literature or archeology, or preserve some ancient holidays and customs.
Conversely, some modern secular nation-states in the Middle East where the government felt threatened by Islam or Islamic movements have tried to build a national identity based on the pre-Islamic heritage or promote a sense of national arrogance based on a pre-Islamic heritage. It is nice to respect and appreciate and know about the good things from the past. However, it is wrong to deploy pre-Islamic identity as a tool to whip up nationalism, strengthen dictators, suppress Islam, and inflame wars with other nation-states. So this is an example of wrong usage of pre-Islamic heritages in the modern era. They do not relate to the ancient civilizations but rather wrong things that occur in our own time.
So there isn't a unilateral view on these civilizations or the ancient world in general, but these are some aspects of how history has been understood in an Islamic context.