On my desk I have a PC dualbooting Windows and Linux and a Macbook. Is there a keyboard that uses a USB dongle and bluetooth so i can connect the dongle to the pc and bluetooth with my mac?
Because of the popularity of smartphones and tablets such as iPhone & iPad, many Bluetooth keyboards are now on the market that can rapidly switch between previously-paired computers/devices. In product descriptions, look for wording such as "switch" and "multi-device".
Your MacBook certainly has Bluetooth support built-in, and your PC may. If not, add a Bluetooth dongle. There are many such dongles; I'd look for one supporting Bluetooth 4.x or later. Modern ones are no bigger than the size of the USB connector plug itself.
While I cannot recommend any of these as I’ve not tried it, here is one found after some quick searching on DuckDuckGo.
K380 Multi-Device Bluetooth Keyboard
Supports Windows®, Mac®, Chrome OS™, Android™, iOS®. Offers a set of
3 buttons to switch back-and-forth between as many as three paired computers/devices.
The problem with your idea is that if a keyboard has two different ways to connect, it's going to favor one of them by design. The demand for a keyboard that types the same thing on two computers at a time is next to zero, so you won't get automatic switching.
What you want is called a KVM switch, and this is an example. It allows you to control more than one computer with the same keyboard, mouse, and monitor. This allows you to switch back and forth by using toggles on the switch, and you can share hardware between the two machines.