Of course you can ask, normally the worst the person can say is "no" and that'll be the end of it. No normal person would hold it against you to go take another career path than what they recommend.
That being said, I think there might be more to this story than you let on. Just from the top of my head I can come up with multiple relevant questions:
- Does the prof even know about alternative B?
- Did you find both A and B yourself and ask the profs opinion, or did the prof suggest you to apply for A out of the blue?
- Did you ask why the prof recommends A?
- Did you ask the prof how alternative B compares to A, in his/her own view?
- How complicated is the application process, does it imply too much work for the prof to write two letters (if for example the fields are very different, or one program requires the letter to be submitted by the prof rather than you uploading/emailing it)
- Why do you not want to take option A? Is there something in the profs logic, in recommending this program, that you don't agree with?
- Why don't you apply to both and see if you actually get an offer from both programs?
In any case, despite the answers to the above question, I still stand by my answer: unless the prof is really old school and would make it a matter of pride, I don't see why anyone would even care which program you choose.
But pondering on these questions might make it a bit more clear for you, both about your own intentions and motivations, and how others (i.e. the prof) might see things.