How should I ask professor for letter of recommendation?
If he's really your only option, e-mail him and ask if he'd be willing. Keep it short and to the point, just tell him you're applying for a program and ask if he'd be willing to write you a letter. Be sure to mention you'll supply him with a CV and any necessary info to write a proper letter if he agrees. 

Hopefully, he'll respond quickly and you can send the necessary info. But as @Roboticist mentioned, you'd really be better off finding someone else if at all possible, especially since he's ignored you in the past.