In order to achieve that, you can condition the installation of the component assigned to the executable that you create a service for.
Let's consider the following checkbox control:
We can see that the checkbox has a property assigned to it that stores its' state and, when the checkbox is checked, the property's value is "CheckBox".
If you want to condition the installation of your service, please go to "Organization" page, select the component assigned to your executable and use the "Condition" field:
This way, your service will only be installed & configured if the checkbox is checked.
Hope this helps!