Since this is a segmentation model, the output layer would be a conv layer instead of a linear one.
If you want to train your model from scratch, you could just use the num_classes argument:
modelA = models.segmentation.fcn_resnet101(
    pretrained=False, num_classes=2)

On the other hand, if you just want to use the pretrained model and create a new classification layer, you could use:
modelB = models.segmentation.fcn_resnet101(pretrained=True)
modelB.classifier[4] = nn.Conv2d(512, num_classes, 1, 1)