Technically, sure (assuming you also build the robot hardware) but we're quite far from having software that can negotiate treaties, figure out how to regulate water rights in California, etc...
Well of course I don't mean to completely replace the government.
But how about making it more lean? How about modernizing with the times? How about making it all much more transparent and accountable? Couldn't open source software do all of this?
We could start with systems that are used by smaller, poorer countries & grow from there.