What round trip transit is available from San Rafael to Petaluma Fairgrounds in the morning and after 6:00 p.m. to 8:00 p.m.?
You list your home as San Rafael. If that is true, then you have resources in your own city to answer the question better than most of us can.
Start with this link
For GoldenGate Transit buses
It looks like it is a short walk up the main st from there
Check out the transit maps or Petaluma map for more
The bus trip on Golden Gate Transit, will be bus no 101
If you want to ride the SMART train, that will take less time.