At 40 KW, size is big enough where there are few options. Assuming a normal installation.
Voltage in Ghana is 415/50Hz. 40KW compressor has a 3 phase 50 HP motor.
4 AWG for a short run of 3 meters or less. 2 AWG for longer.
Voltage fluctuates in Ghana. A VFD is mandatory, and this what you would use to control it. Look up 'VFD for 50 HP motor', and use the info from the VFD manufacturer to determine details of the installation.