You could create a weight tensor in the same shape as your output and target e.g. via:
# setup
target = torch.empty(2, 1, 24, 24).uniform_(0, 1)
output = torch.randn(2, 1, 24, 24)

# weight map creation
threshold = 0.2
weight = target > threshold
weight_value = 10.
weight = weight.float() * weight_value

# weighted loss
loss = F.mse_loss(output, target, reduction='none') * weight