For this battle I’m matching up the 2014 TV show’s Earth-1 Scarlet Speedster and Yoda in Revenge of the Sith, since that’s where he really reached his best.
Weapons: Barry Allen has a lot of stuff up his sleeve. He can run really fast, for starters. But the Speedforce also gives him phasing, fast thinking, lightening bolts and in the right circumstances time travel. Yoda is stuck with the Force and a lightsaber. He has Force-speed, but he won’t outrun the Flash.
Defenses/weakness: Yoda’s lightsaber and the Force are his only defenses, and Barry has only his speed and the suit. The Flash’s main weakness is compassion. He’s willing to sacrifice himself to save others at any chance he gets. Yoda wouldn’t hurt anyone else unless there is no other way, so that weakness is negligible. Yoda refuses to wear armor or a suit and so is exposed to stray fire and explosions, but that doesn’t appear to hinder him. He doesn’t have any other weaknesses.
Skill: By season 3, Barry has enough refined control of his speed to take on any evil speedster that shows up. Yoda’s lightsaber techniques and Force powers are unmatched by anyone other than the Emperor. The tiebreaker is that Yoda has 900 years of experience to back him up.
Mindset/intentions: Yoda has no pleasure in killing the Flash, but he will do what he must, as he did when he was fighting Emperor. Whatever reason Barry has for taking on Yoda, he will do whatever it takes to defeat him, though like Yoda, he wouldn’t kill his enemy if he didn’t have to.
Use of surroundings: The Flash is better at this. Yoda has a defensive fighting style that focuses more on spins and swings and jumps.
Because both of these are “good guys,” neither would try to exploit the others weaknesses by harming anyone else, so the fight would be straightforward. Yoda’s fast lightsaber spinning would be a challenge to get through, but eventually the Flash will find a gap and disarm Yoda. It’s possible that Yoda would go offensive and throw Barry around with the Force. That is how most people defeat Barry, so it’s a good place to start. Or he would create a Force shield that prevents Barry from running at him, and deflect his lightening bolts. Either way, the Flash would probably run around in circles and create time remnants of himself. He would take on Yoda from every angle at once, forcing him to retreat. Yoda could defend himself but won’t be able to kill the Flash.
Theoretically, if the Flash doesn’t make any mistakes, Yoda couldn’t stop him with brute force (pun intended). But mind tricks work on almost anyone, and humans are very susceptible. Yoda is never seen using mind tricks, but if Obi-Wan could pull it off, so can Yoda. Given an opportunity, he could send Barry running home to rethink his life, convince him that he’s fighting the wrong person, or just make him lie down and give up. The fight would be long and hard, but the Speed-force is no match for the Force.