In this circumstance the light kit could be connected to a dimmer switch and the fan motor connected to a toggle switch.
Can you put a ceiling fan on a dimmer switch.
A dimmer switch as the name suggests lets you control the intensity of the light produced from the light to which it is connected such as a ceiling fan with a built in lighting fixture.
You may need an electrician for this.
The wall dimmer switch reduces power flow and interferes with the fan control.
If your ceiling fan has wiring already in place where you have a separate switch for fan control then you can have the separate controls wired to independent switches.
Replace the wall dimmer switch with an on off switch.
You can install a ceiling fan light dual dimmer switch to operate the fan speed and light intensity from the original wall switch location.
By all means you can connect a ceiling fan directly to a dimmer switch but you may run into problems along the way.
The new switch does require an additional electrical wire.