No, you cannot block someone from endorsing you or writing a recommendation for you. However, you can choose to hide endorsements and recommendations from certain people by going to your Settings & Privacy, selecting Visibility, then clicking on Edit your public profile.