You can set a "path cost" for each link and if stp is indeed working
it will find out by its own, that directly going from A to B is
cheaper than first travelling to C.
Check the brctl manpage:
brctl setpathcost <bridge> <port> <cost> sets the port cost of the
port <port> to <cost>. This is a dimensionless metric.
The problem then is, that all Traffic from A to C would then go over B
...
If you set the cost on each port on each host to 10, for example, then
the bridges will find out on their own that they can reach the hosts
directly. The cost from A to B will be 10 so as the cost from A to C
will be 10. And that the cost from A to C when going over B is 20 and
thus this link will not be used.