Prevent a specific app from accessing the Internet
What you're looking for is called an application firewall. One free/open source program that does this job is called LuLu --  https://objective-see.com/products/lulu.html -- with code on github here.