The easiest (and free) way would be to upgrade your system to OSX 10.9 (Mavericks); they actually built this into the newest version of Safari which is included.
If you don't want to venture down that route, there are a few Safari extensions you can use to accomplish your goal.
ClickToPlugin and/or ClickToFlash
YouTube5 extension - blocks them by not supporting them
3: AdBlock Plus - follow the development builds page (the 2nd link) to see when they release their version for Safari - I know it's delayed right now but still in development,
You'll need to google this as I don't have enough rep to post more than 2 links, sorry.
Personally I run Mavericks, but also use ClickToPlugin; it works for any ads that the newest version of Safari doesn't catch.