Welcome to the forum
1997 B2500 with a 5-speed Manual trans would use the M5OD-R1 transmission
4cyl and 3.0l V6 used these ratios: 3.72 / 2.20 / 1.50 / 1.00 / 0.79 / Reverse = 3.40
Rear axle ratio had 3 common options, 3.55, 3.73 and 4.10
As said above, look on drivers door build label or on differential tag, codes seen here:
https://www.therangerstation.com/tech_library/axle_codes.shtml
There was never a 1997 B2500 in the US, they were 1998-2000 over here
There was a 1997 Mazda B2500 built in Thailand and it would have different engine and trans and rear axle
If this is a diesel engine, then for sure none of the above apply
Mazda B-series was built in several countries all with different power trains