Sharepoint - Setting PropertyBag values in SharePoint Online

Works for me with a couple small changes. Instead of manipulating the FieldValues object, just manipulate the AllProperties object directly. Also, set the value to a string, not an int:

web.AllProperties["allowdesigner"] = "0";

Here's the full helper method I use:

public static void AddWebProperty(ClientContext ctx, string propertyName, string propertyValue)
{
    Web web = ctx.Web;
    ctx.Load(web);
    ctx.ExecuteQuery();

    web.AllProperties[propertyName] = propertyValue;
    web.Update();            
    ctx.ExecuteQuery();
}

Derek's answer solves problem for property bag in general, but there's also Site.AllowDesigner property you could use for your specific case.