Hello and welcome to Apple Support Communities, Mr_Lyle.
It I’m understanding you right, each time you wake your iMac from sleep, the Bluetooth Setup Assistant appears even though your bluetooth keyboard is still connected. I certainly understand how bothersome it could be to have that window constantly appear when you know that your bluetooth device is actually connected. I'm happy to help you get to the bottom of this.
Bluetooth devices will typically connect to a Mac within 5 seconds of the computer waking, which prevents the Bluetooth Setup Assistant from opening. It's very possible the reason you're seeing the assistant is because your keyboard is taking a little longer to connect to the Mac. In addition, another possible reason may be that your bluetooth keyboard disconnects to conserve battery power, which is a common feature of bluetooth peripherals. If you normally wake your Mac with your mouse or the Mac power button instead of the keyboard, it could be causing a connection delay.
As a resolution, I recommend adjusting your settings so that you're allowing your Mac to wake from your keyboard, and using your keyboard to wake your Mac going forward. You can view detailed information about all of this in
Using a Bluetooth mouse, keyboard, or trackpad with your Mac
, specifically these sections:
Bluetooth devices are usually available a few moments after your Mac completes its startup process. After waking from sleep, your Mac should find Apple wireless devices right away. Other wireless devices can take up to 5 seconds to be recognized. You might need to click a button on your wireless mouse to wake it up.
Some Bluetooth devices, such as audio headsets, might disconnect to conserve the device's battery power after no audio or data is present for a certain amount of time. When this happens, you might need to push a button on the device to make it active again. Check the documentation that came with your device for more information.
You can click your paired Bluetooth mouse or press a key on your paired Bluetooth keyboard to wake your Mac. You might need to press the space bar on the keyboard.
If clicking the mouse or pressing a key doesn't wake the computer, you might need to allow wireless devices to wake up your computer:
- Choose Apple menu > System Preferences, then click Bluetooth.
- Click Advanced.
- Select the checkbox next to Allow Bluetooth Devices to wake this computer.

In addition to this, you can also go to System Preferences > Bluetooth > Advanced, and uncheck the box next to "Open Bluetooth Setup Assistant at startup if no keyboard is detected" to prevent the setup window from appearing.
Thanks for using Apple Support Communities.
Take care.