Technically it is possible, but it's not as easy as one might wish. IP address ranges are not assigned by country, so any large range probably has smaller sub-ranges within it from a variety of different countries. That is, if you see an IP address from your banned country, you can't block all IPs starting with similar digits, because you'll probably be banning visitors from other countries, too.
In your web search for solutions, the keyword you need is "GeoIP" or maybe "geolocation". I believe that will lead you to databases and subscription lookup services that can translate an individual IP to its country of origin.
To implement on your server, you'll need to look up the IP of each incoming request to determine its country of origin. If it is the banned country, return a 403 response.
I believe there might be an Apache module that can carry out these lookups. Or if your code is all PHP, you can probably do it in PHP. However you do it, it probably adds significant overhead to the handling of each request.
An alternative to a subscription lookup service would be to manually build your own database of as many IP address ranges as you can find from the banned country (not an easy project, I suspect), and use your own code to consult that database for each request.