If I'm not wrong, you ask that how many times a polygon is selected as not within buffer of another polygon. (as completely or partially outside of buffer)
At first, I thought it was complicated. Then I tried something. And it is not so complicated.
Add a field to table named "How_Many", populate with zeros.
And run. (in QGIS 2.18)
layer = iface.activeLayer()
vpr = layer.dataProvider()
feat_list = list(layer.getFeatures())
field_index = layer.fieldNameIndex("How_Many")
for feat_1 in feat_list:
buf = feat_1.geometry().buffer(300, 100)
for feat_2 in layer.getFeatures():
no = not feat_2.geometry().within(buf)
value = feat_2.attribute("How_Many")
value += 1
I tried for four polygons. It works. Some changes are required to work in QGIS3.