Try this:
Search for
Code:
formats:"epub" and formats:"mobi"
then ensure that the third icon besides the search bar shows 3 blue lines with a red diagonal (this is the toggle button for Search Highlighting).
Now the library list should only contain the subset of books in your library that have both ePub and mobi formats.
Select the whole displayed list and then right click, and select
Remove Books and then select the option
Remove books of a specific format from selected books an finally select the ePub option from the dialog.