As Companion posts, that is how I used to accomplish the same thing. It began to become unwieldy when I wanted other rules to apply the same blacklist rules, so I reorganized it as a sort of subroutine.
add action=jump chain=input comment="Blacklist IP trying to hit 22" connection-state=new dst-port=22 in-interface=ether1 jump-target=blacklist protocol=tcp src-address-list=!whitelist.mgmt
add action=add-src-to-address-list address-list=blacklist address-list-timeout=1w chain=blacklist comment="Refresh blacklist timer" connection-state="" src-address-list=blacklist
add action=drop chain=blacklist comment="Drop blacklisted sources" connection-state="" src-address-list=blacklist
add action=add-src-to-address-list address-list=blacklist address-list-timeout=1w chain=blacklist comment="Blacklist processing" src-address-list=pre-blacklist4
add action=add-src-to-address-list address-list=pre-blacklist4 address-list-timeout=1m chain=blacklist src-address-list=pre-blacklist3
add action=add-src-to-address-list address-list=pre-blacklist3 address-list-timeout=1m chain=blacklist src-address-list=pre-blacklist2
add action=add-src-to-address-list address-list=pre-blacklist2 address-list-timeout=1m chain=blacklist src-address-list=pre-blacklist1
add action=add-src-to-address-list address-list=pre-blacklist1 address-list-timeout=1m chain=blacklist log=yes log-prefix="pre-bl1: "
add action=return chain=blacklist
The input chain rule "calls" the blacklist subroutine on any new connection to port 22 in this case.
What I like about this method is I can apply it to forward rules as well, such as if I want to rate limit the number of new connections to an RDP server, web server, mail server, or anything else, without duplicating the series of blacklist rules each time.
Adjust the timers as desired.