There is no #ifdef like in C++ or C#, so if you want to make it completely unavailable, you can make two Godot projects. One for the server, and one for the client. But I find this a bit unpractical for sharing code.
If you keep the same project, whatever you do using GDScript, you'll have to use
is_network_server at some point. Either to call a function or not, or to instance a manager or another.