Dodge dakota

when i put my foot on the brake the vehicle tends to accelerate or race rpms. took it to a mechanic, he said nothing wrong with vehicle, or that it could be the AC trying to level out??? this does only happen when the AC is on. other than don’t use the AC, what can I do, or do you know what the problems is?