A high idle speed can be caused by a poor connection at the Throttle Position Sensor (TPS). Connector replacement kits are available from Mazda dealers and possibly some Ford dealers.Google+
Car Problem Reports
Mazda B2500 High Engine Idle with Manual Transmission
Mazda B2500 Problem
Engine Affected: 2.5L 4 Cylinder
Average Mileage: 109,785 mi (61,000 mi - 170,000 mi)
Visitor, 1998 Mazda B2500, 2.5L 4 Cylinder, 97,500 mi
when I'm driving along. I put the trans in nutural to stop so I don't have to use the clutch.Thats when the motor starts ideling fast.It goes to about 4000 rpm's before it goes back to where it belongs just under a 1000 rpm's. I think it could be a vacume leak? I'm not sure...
Visitor, 1998 Mazda B2500, 2.5L 4 Cylinder
Idle surges to high rpm's? Idle sensor connector at top middle rear of motor gets dust in it. Disconnect, blow out, and tape w/electrical tape to keep dust out. Never had a problem since.
Visitor, 1999 Mazda B2500, 2.5L 4 Cylinder, 61,000 mi
Engine speed increases, often as high as 3500 rpm, when clutch is depressed. Doesn't happen all the time. Drops back to normal when truck is brought to a stop.
Visitor, 1998 Mazda B2500, 2.5L 4 Cylinder, 89,000 mi
engine idles down very slow
Visitor, 2000 Mazda B2500, 2.5L 4 Cylinder, 114,000 mi
I have a 2000 B2500, with the manual transmission. I had the high idle problem and the poor idle condition. Every once in a while it would run rough and no engine light. I replaced the throttle position sensor,and took apart all the harness connection spots and cleaned them. I also replaced the timing belt, water pump, spark plugs, and the wires. The truck runs perfect now. I don't know witch one of those fixed that problem, but for about 200 dollars in parts and a weekend of working on it, it runs perfect. I get about 2-3 more miles per gallon now also. Its well worth the time to just replace everything listed above and be done with it.
Visitor, 2000 Mazda B2500, 2.5L 4 Cylinder, 170,000 mi
I have had this 3 times (fixed twice) and only seems to happen when it is very hot outside.