Did England ever acquire a colony mainly to keep it away from a rival?
Short answerYes. The example given is African territory that Britain did not especially want but acquired to prevent France from taking it.
NotesImperial acquisition could follow a broad pattern of strategic denial, with no single colony named here. Whole tranches of Africa were acquired because Britain did not want France to control them, even when Britain had little positive desire for the territory itself. Denying a rival a position could be treated as a benefit even when possession carried costs. Rivalry could therefore drive expansion into territories with little intrinsic appeal to Britain.