The motor is running is on 5 cylinders and one of the rocker arms is clattering like crazy. I can hear it plain as day. There is something broken on the failing cylinder. Rocker arm, pushrod, valve spring, maybe a bent valve. Find the failing cylinder, remove the valve cover and you will find the problem.
Now the problem, the dealer broke it, they must fix it. Does the car have comprehensive insurance coverage? If so, file a claim against the dealer. Another path, get an estimate for repairs, then file in small claims court for the money.
You are clearly being screwed over by the dealer. You can lay down and take it, or you can fight back. If it were me, I would be all over that dealer....
Good luck.