We stayed for a week last July in Cauterets, deep in the French Pyrenees. It’s just north of the Spanish border, but you can’t get there directly from Spain unless you’re hiking. You can eventually reach Cauterets from Spain (and within France) by train and/or bus, but we had a rental car. It’s a bit south of the French town Lourdes. The Tour de France bike race comes through, or near, Cauterets often, and it’s a ski destination in winter, along with having hot springs spas year-round.
We were there to see The Tour in July, and also did lots of hiking, but didn’t bike. We did encounter some mountain bikers, and there’s a substantial network of bike trails in the area. Looking online just now, I see that there’s at least one shop that rents mountain (and other) bikes - Roc&Trail. Their Website is mostly in French, but the bike rental part is largely in English https://www.roc-trail.com/content/8-location-velos-skis . For rental details, click on the blue box that says “Location Cauterets.” They rent bikes (velos) and also skis. Their homepage is https://www.roc-trail.com/ , and again, to get to their bike rental section from their homepage, click on “Location Vélos/Skis.
You can reach mountain bike trails from right in town, and it was a great place to stay. We stayed at the Hôtel Le Lion d’ Or.