Do contract research expenses paid to a U.S.-based company that uses foreign contractors qualify for the R&D credit?

Generally, no.  If the qualifying activities are performed outside of the U.S. (including Puerto Rico and U.S. territories), then the associated contract research payments will not qualify for the credit.  However, if the company uses foreign-based employees that travel to the U.S. and perform qualifying activities in the U.S., then the associated expense can potentially be included in the R&D credit subject to all other qualification rules.