According to IRS Pub 502:
You can include in medical expenses amounts you pay for transportation
to another city if the trip is primarily for, and essential to,
receiving medical services. You may be able to include up to $50 for
each night for each person. You can include lodging for a person
traveling with the person receiving the medical care. For example, if
a parent is traveling with a sick child, up to $100 per night can be
included as a medical expense for lodging. Meals are not included. See
Lodging , earlier.
You cannot include in medical expenses a trip or vacation taken merely
for a change in environment, improvement of morale, or general
improvement of health, even if the trip is made on the advice of a
doctor. However, see Medical Conferences , earlier.
My interpretation of this would be the following test:
1. Is the trip primarily for the procedure? According to your statements, yes.
2. Is the trip essential to receiving the care? According to your statements, yes, because you can save a lot of money by doing this compared to having just the procedure done in the US. (Or maybe you cannot afford it otherwise.)
It appears to me that you can deduct the cost of the procedure, the airfare, and then $100/night. If it were me I would document a few different quotes from dentists local to you showing that it is in fact more expensive like you said it is, and file that away with your receipts. It also would be a good idea to ask the dentist in Costa Rica how much just the procedure is by itself, and then the airfare too, because you'll likely need that in your calculation of how much to deduct. Also, make sure the itemized cost of the procedure itself is "reasonable". If the trip costs 10K, and they tell you that the deductible parts equal $9,999, and then $1 is for food, entertainment, etc, that is likely not reasonable in the eyes of an auditor. Also, in general, remember that just because you're saving money and getting A + B (B for bonus) instead of just A, that doesn't mean that B is deductible. One has nothing to do with the other.
Lastly, for deductions of this magnitude, I'd highly recommend talking to an accountant, because I am not one. (And if you do, please report back. I'm curious to know where they agree/disagree with me.)