Yes, within Morocco's exchange control rules. The general foreign exchange instruction (IGOC), in force since 3 January 2022, sets a MAD 200 million ceiling for any Moroccan investment abroad, whatever the country. Before 2022 the ceiling was MAD 100 million in Africa and MAD 50 million elsewhere.
Below the ceiling, your Moroccan bank makes the transfer without prior approval from the Office des Changes. Above it, the Office must approve. The instruction is revised regularly, so check the company's eligibility conditions and supporting documents with your bank before you sign.
If you invest personally as a Moroccan resident, the rules differ from those for a company. Raise it with your bank or the Office des Changes at the scoping stage: the structure you choose (direct, through your Moroccan company, or from inside the Kingdom) depends on it.