Scratchy records

Is there a way to filter out scratches on records when recording

No, but you can do it after recording.

a) there is the Click Removal effect in Audacity:

b) personally I preferred to use Brian Davis’ excellent ClickRepair - it costs a little but produces almost magical results. See this sticky thread: