EDIT: to drop the end of the string starting from the character before the underscore, but preserving the extension you can use a regex:
import re
s = "ABC_Y6N02.20.0025D_BF3DAC.tgz.bin"
print( re.sub(r"^(.*)[^_]_[^\.]*(\.tgz\.bin)$", r"\1\2",s ).lower())
returns
abc_y6n02.20.0025.tgz.bin
1
solved Removing a substring from a string in python