Volva's aunt is right, the only way to visit the Dordogne and the Lot is to have a car.
The vast majority of places in the Dordogne valley or Lot valley are not accessible by public transport. They are located in small villages not served by trains.
The bus lines are mainly intended for school transport and their schedules during school holidays or on weekends are very limited
So, unfortunately wherever you are leaving from, it is not possible to go to Pech Merle by public transport.
From Sarlat train station it is possible to go to Lascaux 4 by bus with line 336.
See the timetable here:
https://drive.google.com/file/d/1tGJHhgSpViEU734tbt4r23EhCLaI_0ag/view?usp=sharing
Clarification about the timetable
Columns with a (1): Only from Monday to Friday during school periods.
Columns with a (2): Only Monday to Friday during school holidays
Four right columns:
S = Saturday
D = Sunday
JF = public holidays
Here is the map of bus and train lines in Dordogne:
https://drive.google.com/file/d/1yz2ho1kuDFz7APOK6NOXTIlgL8pO_deM/view?usp=sharing
Here is another map.
I made this map with the vast majority of things to see and do in the region. I have represented by a gray square (which may seem very small) the area that I call "The area for beginners and poorly informed tourists": :)). Sarlat is included in this square.
https://www.google.com/maps/d/edit?mid=1OdPOg8AgsNn0Jlv1cNHkujaWv9p_Jpc&usp=sharing
Also note that if Sarlat is more or less typical, it is above all a very touristy place.
In Sarlat you will be more in a kind of theme park with its hotels, restaurants, bars, entertainment, than in the reality of the Dordogne.
Explore it by car and you will see.