Perhaps something like this:
... sorry, does not work
edit:
this should
$filename(Dupes-Album.txt,utf-8) $loop(%albumartist%%album%,1)$puts(tmp_album,%album%)$puts(tmp_artist,%albumartist%)
$loop(%album%)$if($and($eql(%album%,$get(tmp_album)),$neql(%albumartist%,$get(tmp_artist))),double: %albumartist% %album%,)$loopend()$loopend()