How can I use a variable to include a linked image?

You are most of the way there, you simply have to echo it into the include:

<a href="https://wordpress.stackexchange.com/questions/276748/<?php echo $url;?>/image.png"><img src="https://wordpress.stackexchange.com/questions/276748/<?php echo $url;?>/image.png"></a>

If you are already echoing this whole line, then you simply concatenate the variable:

echo '<a href="'.$url.'/image.png"><img src="'.$url.'/image.png"></a>'

Do some reading on PHP “concatenation” 🙂