who built it?
Sultan Ahmad al-Mansur al-Dhahabi
El Badi Palace
The El Badi Palace proper, however, was constructed by Sultan Ahmad al-Mansur al-Dhahabi (ruled 1578-1603) at the height of the Saadian dynasty's power. 
what country casablanca and marrakech are located in Kingdom of Morocco where did the second mentioned place get the name from? One possible origin of the name Marrakesh is from the Berber words "amur and akush", which means "Land of God". does it have any palace in it? Yes, the main palaces are El Badi Palace, the Royal Palace and Bahia Palace. when was the first one constructed? The construction work began in December 1578 and took 15 years for completion.
wiki:21076441
El Badi Palace [SEP] Background
The palace's construction, along with al-Mansur's other projects, was probably funded by the substantial ransom paid by the Portuguese after the Battle of the Three Kings in 1578. The wealth of al-Mansur's reign was also due to the Saadians' control of the sugar trade. Morocco was at that time a significant exporter of sugar towards Europe, along with other products such as silk, copper, and leather. In 1590 al-Mansur launched military expeditions to the south which resulted in the conquest of Timbuktu and Gao in Mali and the defeat of the Songhai Empire. This control of the trans-Saharan trade routes allowed al-Mansur to increase Morocco's access not only to gold but also to slaves – on which the sugar processing industry relied and which were necessary to compete with the sugar trade coming from Brazil and the Caribbean (controlled by Europeans and also reliant on slaves).