Hi chirriacos,
Welcome to Apple Support Communities. We'd recommend first testing with another network if you haven't already. That will give you an idea of whether the issue is related to your Mac or possibly the network.
Next, use the guidance from the related article If your Mac isn't connecting to the internet over Wi-Fi - Apple Support. Although it sounds like your Wi-Fi does connect, this can help with intermittent disconnect issues as well. All sections of that article can help but we'd like to highlight the diagnostics tools section which might be particularly helpful if this is network-related.
"Use the built-in diagnostic tools
Wi-Fi Recommendations. Click Wi-Fi in Control Center or the menu bar and check for a menu item named Wi-Fi Recommendations. If you see it, your Mac has detected an issue and has recommendations. Choose Wi-Fi Recommendations to learn more.
Wireless Diagnostics. Press and hold the Option key on your keyboard while clicking Wi-Fi in Control Center or the menu bar, then choose Open Wireless Diagnostics from the menu. Learn more about using Wireless Diagnostics to analyze your wireless environment."
Kind regards.