It's definitely something an arduino can do. There are many build guides online
https://www.electronicsforu.com/electronics-projects/automatic-water-tank-system
https://www.instructables.com/Automatic-Water-Tank-Filling-Arduino/
https://www.instructables.com/Automatic-Over-Head-Watertank-Filling-System-Using-1/
There are also cheap off the shelf solutions:
https://www.amazon.com/Automatic-Controller-Detection-Conservancy-Projects/dp/B081NPLJJ9/